use of ezvcard.io.scribe.CannotParseScribe in project ez-vcard by mangstadt.
the class XCardReaderTest method cannotParseException.
@Test
public void cannotParseException() throws Exception {
// @formatter:off
String xml = "<vcards xmlns=\"" + V4_0.getXmlNamespace() + "\">" + "<vcard>" + "<group name=\"grp\">" + "<cannotparse><text>value1</text></cannotparse>" + "</group>" + "<cannotparse><text>value2</text></cannotparse>" + "<x-foo><text>value</text></x-foo>" + "</vcard>" + "</vcards>";
XCardReader reader = new XCardReader(xml);
reader.registerScribe(new CannotParseScribe());
VCardAsserter asserter = new VCardAsserter(reader);
asserter.next(V4_0);
asserter.rawProperty("x-foo").dataType(VCardDataType.TEXT).value("value").noMore();
asserter.xml().group("grp").value("<cannotparse xmlns=\"" + V4_0.getXmlNamespace() + "\"><text>value1</text></cannotparse>").next().value("<cannotparse xmlns=\"" + V4_0.getXmlNamespace() + "\"><text>value2</text></cannotparse>").noMore();
asserter.warnings(25, 25);
asserter.done();
// @formatter:on
}
use of ezvcard.io.scribe.CannotParseScribe in project ez-vcard by mangstadt.
the class VCardReaderTest method cannotParseException.
@Test
public void cannotParseException() throws Exception {
for (VCardVersion version : VCardVersion.values()) {
// @formatter:off
String str = "BEGIN:VCARD\r\n" + "VERSION:" + version + "\r\n" + "group.CANNOTPARSE;PARAM=value;VALUE=text:value\r\n" + "X-FOO:value\r\n" + "END:VCARD\r\n";
VCardReader reader = new VCardReader(str);
reader.registerScribe(new CannotParseScribe());
VCardAsserter asserter = new VCardAsserter(reader);
asserter.next(version);
asserter.rawProperty("X-FOO").value("value").noMore();
asserter.rawProperty("CANNOTPARSE").group("group").param("PARAM", "value").dataType(VCardDataType.TEXT).value("value").noMore();
asserter.warnings(25);
asserter.done();
// @formatter:on
}
}
use of ezvcard.io.scribe.CannotParseScribe in project ez-vcard by mangstadt.
the class HCardParserTest method cannotParseException.
@Test
public void cannotParseException() throws Exception {
// @formatter:off
String html = "<html>" + "<body>" + "<div class=\"vcard\">" + "<span class=\"cannotparse\">value</span>" + "<span class=\"x-foo\">value</span>" + "</div>" + "</body>" + "</html>";
HCardParser parser = new HCardParser(html);
parser.registerScribe(new CannotParseScribe());
VCardAsserter asserter = new VCardAsserter(parser);
asserter.next(V3_0);
asserter.rawProperty("x-foo").value("value").noMore();
asserter.rawProperty("cannotparse").value("<span class=\"cannotparse\">value</span>").noMore();
asserter.warnings(25);
asserter.done();
// @formatter:on
}
use of ezvcard.io.scribe.CannotParseScribe in project ez-vcard by mangstadt.
the class JCardReaderTest method cannotParseException.
@Test
public void cannotParseException() throws Throwable {
// @formatter:off
String json = "[\"vcard\"," + "[" + "[\"version\", {}, \"text\", \"4.0\"]," + "[\"cannotparse\", {}, \"text\", \"value\"]," + "[\"x-foo\", {}, \"text\", \"value\"]" + "]" + "]";
JCardReader reader = new JCardReader(json);
reader.registerScribe(new CannotParseScribe());
VCardAsserter asserter = new VCardAsserter(reader);
asserter.next(V4_0);
asserter.rawProperty("x-foo").dataType(VCardDataType.TEXT).value("value").noMore();
asserter.rawProperty("cannotparse").dataType(VCardDataType.TEXT).value("value").noMore();
asserter.warnings(25);
asserter.done();
// @formatter:on
}
Aggregations