use of ezvcard.property.asserter.VCardAsserter in project ez-vcard by mangstadt.
the class JCardReaderTest method no_properties.
@Test
public void no_properties() throws Throwable {
// @formatter:off
VCardAsserter asserter = readJson("[\"vcard\"," + "[" + "]" + "]");
// default to 4.0
asserter.next(V4_0);
// missing VERSION property
asserter.warnings(29);
asserter.done();
// @formatter:on
}
use of ezvcard.property.asserter.VCardAsserter in project ez-vcard by mangstadt.
the class JCardReaderTest method invalid_version.
@Test
public void invalid_version() throws Exception {
// @formatter:off
VCardAsserter asserter = readJson("[\"vcard\"," + "[" + "[\"version\", {}, \"text\", \"3.0\"]," + "[\"fn\", {}, \"text\", \"John Doe\"]" + "]" + "]");
// should still set the version to 4.0
asserter.next(V4_0);
asserter.simpleProperty(FormattedName.class).value("John Doe").noMore();
asserter.warnings(30);
asserter.done();
// @formatter:on
}
use of ezvcard.property.asserter.VCardAsserter in project ez-vcard by mangstadt.
the class JCardReaderTest method read_multiple.
@Test
public void read_multiple() throws Throwable {
// @formatter:off
VCardAsserter asserter = readJson("[" + "[\"vcard\"," + "[" + "[\"version\", {}, \"text\", \"4.0\"]," + "[\"fn\", {}, \"text\", \"John Doe\"]" + "]" + "]," + "[\"vcard\"," + "[" + "[\"version\", {}, \"text\", \"4.0\"]," + "[\"fn\", {}, \"text\", \"Jane Doe\"]" + "]" + "]" + "]");
asserter.next(V4_0);
asserter.simpleProperty(FormattedName.class).value("John Doe").noMore();
asserter.next(V4_0);
asserter.simpleProperty(FormattedName.class).value("Jane Doe").noMore();
asserter.done();
// @formatter:on
}
use of ezvcard.property.asserter.VCardAsserter in project ez-vcard by mangstadt.
the class HCardParserTest method url_of_vcard_specified.
@Test
public void url_of_vcard_specified() throws Exception {
// @formatter:off
String html = "<html>" + "<body>" + "<div class=\"vcard\">" + "<a class=\"fn url\" href=\"index.html\">John Doe</span>" + "</div>" + "</body>" + "</html>";
HCardParser parser = new HCardParser(html, "http://johndoe.com/vcard.html");
VCardAsserter asserter = new VCardAsserter(parser);
asserter.next(V3_0);
asserter.simpleProperty(FormattedName.class).value("John Doe").noMore();
asserter.simpleProperty(Url.class).value("http://johndoe.com/index.html").noMore();
asserter.simpleProperty(Source.class).value("http://johndoe.com/vcard.html").noMore();
asserter.done();
// @formatter:on
}
use of ezvcard.property.asserter.VCardAsserter in project ez-vcard by mangstadt.
the class HCardParserTest method anchor_in_url.
@Test
public void anchor_in_url() throws Exception {
// @formatter:off
String html = "<html>" + "<body>" + "<div class=\"vcard\">" + "<span class=\"fn\">John Doe</span>" + "</div>" + "<div id=\"anchor\">" + "<div class=\"vcard\">" + "<span class=\"fn\">Jane Doe</span>" + "</div>" + "</div>" + "</body>" + "</html>";
HCardParser parser = new HCardParser(html, "http://johndoe.com/vcard.html#anchor");
VCardAsserter asserter = new VCardAsserter(parser);
asserter.next(V3_0);
asserter.simpleProperty(FormattedName.class).value("Jane Doe").noMore();
asserter.simpleProperty(Source.class).value("http://johndoe.com/vcard.html#anchor").noMore();
asserter.done();
// @formatter:on
}
Aggregations