Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
18 | daniel-mar | 1 | package de.viathinksoft.utils.mail.address; |
2 | |||
3 | import static org.junit.Assert.*; |
||
4 | |||
5 | import java.net.IDN; |
||
6 | |||
7 | import org.junit.Test; |
||
8 | |||
9 | public class EMailPreprocessorTest { |
||
10 | |||
11 | private static final String ExamplePunycode = "xn--zckzah"; // Japanese IDN |
||
12 | // Test TLD |
||
13 | private static final String ExampleUnicode = IDN.toUnicode(ExamplePunycode); |
||
14 | |||
15 | @Test |
||
16 | public void preprocessTrimTest() { |
||
17 | // Check that trim() works |
||
18 | assertEquals( |
||
19 | "test@test.de", |
||
20 | EMailPreprocessor |
||
21 | .preprocess(" \t \n\t\n\r test@test.de \t \n\r\n \r ")); |
||
22 | } |
||
23 | |||
24 | @Test |
||
25 | public void preprocessIDNTest() { |
||
26 | // Check that IDN addresses are decoded |
||
27 | assertEquals("test@" + ExamplePunycode + "." + ExamplePunycode, |
||
28 | EMailPreprocessor.preprocess(" \t \n\t\n\r test@" |
||
29 | + ExampleUnicode + "." + ExampleUnicode |
||
30 | + " \t \n\r\n \r ")); |
||
31 | } |
||
32 | |||
33 | } |