Search in sources :

Example 6 with Gobble

use of ezvcard.util.Gobble in project ez-vcard by mangstadt.

the class XCardDocumentTest method write_utf8.

@Test
public void write_utf8() throws Throwable {
    VCard vcard = new VCard();
    vcard.addNote("\u019dote");
    XCardDocument xcard = new XCardDocument();
    xcard.addVCard(vcard);
    File file = tempFolder.newFile();
    xcard.write(file);
    String xml = new Gobble(file).asString("UTF-8");
    assertTrue(xml.matches("(?i)<\\?xml.*?encoding=\"utf-8\".*?\\?>.*"));
    assertTrue(xml.matches(".*?<note><text>\u019dote</text></note>.*"));
}
Also used : Gobble(ezvcard.util.Gobble) VCard(ezvcard.VCard) File(java.io.File) Test(org.junit.Test)

Aggregations

Gobble (ezvcard.util.Gobble)6 VCard (ezvcard.VCard)4 File (java.io.File)4 Test (org.junit.Test)4