use of ezvcard.io.scribe.SkipMeScribe in project ez-vcard by mangstadt.
the class VCardReaderTest method skipMeException.
@Test
public void skipMeException() throws Exception {
for (VCardVersion version : VCardVersion.values()) {
// @formatter:off
String str = "BEGIN:VCARD\r\n" + "VERSION:" + version + "\r\n" + "SKIPME:value\r\n" + "X-FOO:value\r\n" + "END:VCARD\r\n";
VCardReader reader = new VCardReader(str);
reader.registerScribe(new SkipMeScribe());
VCardAsserter asserter = new VCardAsserter(reader);
asserter.next(version);
asserter.rawProperty("X-FOO").value("value").noMore();
asserter.warnings(22);
asserter.done();
// @formatter:on
}
}
use of ezvcard.io.scribe.SkipMeScribe 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.io.scribe.SkipMeScribe 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.io.scribe.SkipMeScribe 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.io.scribe.SkipMeScribe in project ez-vcard by mangstadt.
the class JCardReaderTest method skipMeException.
@Test
public void skipMeException() throws Throwable {
// @formatter:off
String json = "[\"vcard\"," + "[" + "[\"version\", {}, \"text\", \"4.0\"]," + "[\"skipme\", {}, \"text\", \"value\"]" + "]" + "]";
// @formatter:on
JCardReader reader = new JCardReader(json);
reader.registerScribe(new SkipMeScribe());
VCardAsserter asserter = new VCardAsserter(reader);
asserter.next(V4_0);
asserter.warnings(22);
asserter.done();
}
Aggregations