use of ezvcard.property.SkipMeProperty in project ez-vcard by mangstadt.
the class VCardWriterTest method skipMeException.
@Test
public void skipMeException() throws Throwable {
VCard vcard = new VCard();
vcard.addProperty(new SkipMeProperty());
vcard.addExtendedProperty("X-FOO", "value");
StringWriter sw = new StringWriter();
VCardWriter vcw = new VCardWriter(sw, VCardVersion.V3_0);
vcw.setAddProdId(false);
vcw.registerScribe(new SkipMeScribe());
vcw.write(vcard);
String actual = sw.toString();
// @formatter:off
String expected = "BEGIN:VCARD\r\n" + "VERSION:3.0\r\n" + "X-FOO:value\r\n" + "END:VCARD\r\n";
// @formatter:on
assertEquals(actual, expected);
}
use of ezvcard.property.SkipMeProperty in project ez-vcard by mangstadt.
the class XCardDocumentTest method add_skipMeException.
@Test
public void add_skipMeException() throws Throwable {
VCard vcard = new VCard();
vcard.addProperty(new SkipMeProperty());
vcard.addExtendedProperty("x-foo", "value");
XCardDocument xcard = new XCardDocument();
XCardDocumentStreamWriter writer = xcard.writer();
writer.setAddProdId(false);
writer.registerScribe(new SkipMeScribe());
writer.write(vcard);
Document actual = xcard.getDocument();
// @formatter:off
String xml = "<vcards xmlns=\"" + V4_0.getXmlNamespace() + "\">" + "<vcard>" + "<x-foo><unknown>value</unknown></x-foo>" + "</vcard>" + "</vcards>";
Document expected = XmlUtils.toDocument(xml);
// @formatter:on
assertXMLEqual(expected, actual);
}
use of ezvcard.property.SkipMeProperty in project ez-vcard by mangstadt.
the class XCardWriterTest method skipMeException.
@Test
public void skipMeException() throws Exception {
writer.registerScribe(new SkipMeScribe());
VCard vcard = new VCard();
vcard.addProperty(new SkipMeProperty());
vcard.addExtendedProperty("x-foo", "value");
writer.write(vcard);
writer.close();
// @formatter:off
String expected = "<vcards xmlns=\"" + V4_0.getXmlNamespace() + "\">" + "<vcard>" + "<x-foo><unknown>value</unknown></x-foo>" + "</vcard>" + "</vcards>";
// @formatter:on
assertOutput(expected);
}
use of ezvcard.property.SkipMeProperty in project ez-vcard by mangstadt.
the class JCardWriterTest method skipMeException.
@Test
public void skipMeException() throws Throwable {
StringWriter sw = new StringWriter();
JCardWriter writer = new JCardWriter(sw);
writer.registerScribe(new SkipMeScribe());
writer.setAddProdId(false);
VCard vcard = new VCard();
vcard.setFormattedName("John Doe");
vcard.addProperty(new SkipMeProperty());
writer.write(vcard);
writer.close();
// @formatter:off
String expected = "[\"vcard\"," + "[" + "[\"version\",{},\"text\",\"4.0\"]," + "[\"fn\",{},\"text\",\"John Doe\"]" + "]" + "]";
// @formatter:on
assertEquals(expected, sw.toString());
}
use of ezvcard.property.SkipMeProperty in project ez-vcard by mangstadt.
the class XCardDocumentTest method add_no_scribe_registered.
@Test(expected = IllegalArgumentException.class)
public void add_no_scribe_registered() throws Throwable {
VCard vcard = new VCard();
SkipMeProperty property = new SkipMeProperty();
vcard.addProperty(property);
XCardDocument xcard = new XCardDocument();
xcard.addVCard(vcard);
}
Aggregations