use of ezvcard.io.scribe.SkipMeScribe 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.io.scribe.SkipMeScribe in project ez-vcard by mangstadt.
the class HCardParserTest method skipMeException.
@Test
public void skipMeException() throws Exception {
// @formatter:off
String html = "<html>" + "<body>" + "<div class=\"vcard\">" + "<span class=\"skipme\">value</span>" + "<span class=\"x-foo\">value</span>" + "</div>" + "</body>" + "</html>";
HCardParser parser = new HCardParser(html);
parser.registerScribe(new SkipMeScribe());
VCardAsserter asserter = new VCardAsserter(parser);
asserter.next(V3_0);
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 XCardReaderTest method skipMeException.
@Test
public void skipMeException() throws Exception {
// @formatter:off
String xml = "<vcards xmlns=\"" + V4_0.getXmlNamespace() + "\">" + "<vcard>" + "<skipme><text>value</text></skipme>" + "<x-foo><text>value</text></x-foo>" + "</vcard>" + "</vcards>";
XCardReader reader = new XCardReader(xml);
reader.registerScribe(new SkipMeScribe());
VCardAsserter asserter = new VCardAsserter(reader);
asserter.next(V4_0);
asserter.rawProperty("x-foo").dataType(VCardDataType.TEXT).value("value").noMore();
asserter.warnings(22);
asserter.done();
// @formatter:on
}
Aggregations