diff --git a/src/test/java/com/loafle/overflow/commons/utils/EmailSenderTest.java b/src/test/java/com/loafle/overflow/commons/utils/EmailSenderTest.java new file mode 100644 index 0000000..60ff3ca --- /dev/null +++ b/src/test/java/com/loafle/overflow/commons/utils/EmailSenderTest.java @@ -0,0 +1,43 @@ +package com.loafle.overflow.commons.utils; + +import com.loafle.overflow.spring.AppConfigTest; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import java.net.URLDecoder; +import java.net.URLEncoder; + +import static org.junit.Assert.*; + +/** + * Created by geek on 17. 9. 5. + */ +@Ignore +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {AppConfigTest.class}) +public class EmailSenderTest { + + @Autowired + private EmailSender emailSender; + + @Test + public void encrypt() throws Exception { + // dZQgXM1o/Cx48X8DM+6ec/oPfqA2l/LdWtijOZ2EnWk= + String en = this.emailSender.encrypt("geekdev@naver.com"); + String encode = URLEncoder.encode(en, "UTF-8"); + Assert.assertEquals(encode , "dZQgXM1o%2FCx48X8DM%2B6ec%2FoPfqA2l%2FLdWtijOZ2EnWk%3D"); + } + + @Test + public void decrypt() throws Exception { + String decode = URLDecoder.decode("dZQgXM1o%2FCx48X8DM%2B6ec%2FoPfqA2l%2FLdWtijOZ2EnWk%3D", "UTF-8"); + String dn = this.emailSender.decrypt(decode); + Assert.assertEquals(dn , "geekdev@naver.com"); + } + +} \ No newline at end of file