-
Notifications
You must be signed in to change notification settings - Fork 93
/
Copy pathIssue112.java
65 lines (55 loc) · 1.71 KB
/
Issue112.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package ezvcard.issue;
import ezvcard.Ezvcard;
import ezvcard.VCard;
import ezvcard.VCardVersion;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
* @author Michael Angstadt
* @see "https://github.com/mangstadt/ez-vcard/issues/112"
*/
public class Issue112 {
@Test
public void test() {
String vcardStr = //@formatter:off
"BEGIN:VCARD\r\n" +
"VERSION:2.1\r\n" +
"N;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:=C3=96=64=65;=C3=96=6D=C3=BC=72;;;\r\n" +
"FN;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:=C3=96=6D=C3=BC=72=20=C3=96=64=65\r\n" +
"END:VCARD\r\n"; //@formatter:on
VCard vcard = Ezvcard.parse(vcardStr).first();
VCardVersion version = VCardVersion.V2_1;
{
String actual = Ezvcard.write(vcard).version(version).prodId(false).go();
String expected = //@formatter:off
"BEGIN:VCARD\r\n" +
"VERSION:2.1\r\n" +
"N;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:=C3=96de;=C3=96m=C3=BCr\r\n" +
"FN;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:=C3=96m=C3=BCr =C3=96de\r\n" +
"END:VCARD\r\n"; //@formatter:on
assertEquals(expected, actual);
}
version = VCardVersion.V3_0;
{
String actual = Ezvcard.write(vcard).version(version).prodId(false).go();
String expected = //@formatter:off
"BEGIN:VCARD\r\n" +
"VERSION:3.0\r\n" +
"N:Öde;Ömür\r\n" +
"FN:Ömür Öde\r\n" +
"END:VCARD\r\n"; //@formatter:on
assertEquals(expected, actual);
}
version = VCardVersion.V4_0;
{
String actual = Ezvcard.write(vcard).version(version).prodId(false).go();
String expected = //@formatter:off
"BEGIN:VCARD\r\n" +
"VERSION:4.0\r\n" +
"N:Öde;Ömür;;;\r\n" +
"FN:Ömür Öde\r\n" +
"END:VCARD\r\n"; //@formatter:on
assertEquals(expected, actual);
}
}
}