Search in sources :

Example 71 with VCardAsserter

use of ezvcard.property.asserter.VCardAsserter in project ez-vcard by mangstadt.

the class HCardParserTest method vcard_element_has_other_classes.

@Test
public void vcard_element_has_other_classes() throws Exception {
    // @formatter:off
    VCardAsserter asserter = readHtml("<html>" + "<body>" + "<div class=\"foo bar vcard\">" + "<span class=\"fn\">John Doe</span>" + "</div>" + "</body>" + "</html>");
    asserter.next(V3_0);
    asserter.simpleProperty(FormattedName.class).value("John Doe").noMore();
    asserter.done();
// @formatter:on
}
Also used : VCardAsserter(ezvcard.property.asserter.VCardAsserter) Test(org.junit.Test)

Example 72 with VCardAsserter

use of ezvcard.property.asserter.VCardAsserter in project ez-vcard by mangstadt.

the class HCardParserTest method convert_instant_messenging_urls_to_impp_types.

@Test
public void convert_instant_messenging_urls_to_impp_types() throws Exception {
    // @formatter:off
    VCardAsserter asserter = readHtml("<html>" + "<body>" + "<div class=\"vcard\">" + "<a class=\"url\" href=\"aim:goim?screenname=ShoppingBuddy\">IM with the AIM ShoppingBuddy</a>" + "</div>" + "</body>" + "</html>");
    asserter.next(V3_0);
    asserter.impp().uri("aim:ShoppingBuddy").noMore();
    asserter.done();
// @formatter:on
}
Also used : VCardAsserter(ezvcard.property.asserter.VCardAsserter) Test(org.junit.Test)

Example 73 with VCardAsserter

use of ezvcard.property.asserter.VCardAsserter in project ez-vcard by mangstadt.

the class HCardParserTest method property_tags_within_other_property_tags.

@Test
public void property_tags_within_other_property_tags() throws Exception {
    // @formatter:off
    VCardAsserter asserter = readHtml("<html>" + "<body>" + "<div class=\"vcard\">" + "<div class=\"n\">" + "<span class=\"family-name org\">Smith</span>" + "</div>" + "</div>" + "</body>" + "</html>");
    asserter.next(V3_0);
    asserter.structuredName().family("Smith").noMore();
    asserter.listProperty(Organization.class).values("Smith").noMore();
    asserter.done();
// @formatter:on
}
Also used : VCardAsserter(ezvcard.property.asserter.VCardAsserter) Test(org.junit.Test)

Example 74 with VCardAsserter

use of ezvcard.property.asserter.VCardAsserter in project ez-vcard by mangstadt.

the class HCardParserTest method property_tags_are_not_direct_children_of_root_tag.

@Test
public void property_tags_are_not_direct_children_of_root_tag() throws Exception {
    // @formatter:off
    VCardAsserter asserter = readHtml("<html>" + "<body>" + "<div class=\"vcard\">" + "<h1>Welcome to my webpage</h1>" + "<table>" + "<tr>" + "<td>" + "<a class=\"fn url\" href=\"http://johndoe.com\">John Doe</span>" + "</td>" + "<td>" + "<span class=\"tel\">(555) 555-1234</span>" + "</td>" + "</tr>" + "</table>" + "</div>" + "</body>" + "</html>");
    asserter.next(V3_0);
    asserter.simpleProperty(FormattedName.class).value("John Doe").noMore();
    asserter.simpleProperty(Url.class).value("http://johndoe.com").noMore();
    asserter.telephone().text("(555) 555-1234").noMore();
    asserter.done();
// @formatter:on
}
Also used : VCardAsserter(ezvcard.property.asserter.VCardAsserter) Test(org.junit.Test)

Example 75 with VCardAsserter

use of ezvcard.property.asserter.VCardAsserter in project ez-vcard by mangstadt.

the class JCardReaderTest method read_single.

@Test
public void read_single() throws Throwable {
    // @formatter:off
    VCardAsserter asserter = readJson("[\"vcard\"," + "[" + "[\"version\", {}, \"text\", \"4.0\"]," + "[\"fn\", {}, \"text\", \"John Doe\"]" + "]" + "]");
    asserter.next(V4_0);
    asserter.simpleProperty(FormattedName.class).value("John Doe").noMore();
    asserter.done();
// @formatter:on
}
Also used : VCardAsserter(ezvcard.property.asserter.VCardAsserter) Test(org.junit.Test)

Aggregations

VCardAsserter (ezvcard.property.asserter.VCardAsserter)86 Test (org.junit.Test)84 Url (ezvcard.property.Url)12 VCard (ezvcard.VCard)10 VCardVersion (ezvcard.VCardVersion)10 FreeBusyUrl (ezvcard.property.FreeBusyUrl)9 Note (ezvcard.property.Note)7 Organization (ezvcard.property.Organization)7 Photo (ezvcard.property.Photo)7 FormattedName (ezvcard.property.FormattedName)6 Key (ezvcard.property.Key)6 UtcOffset (ezvcard.util.UtcOffset)5 CannotParseScribe (ezvcard.io.scribe.CannotParseScribe)4 SkipMeScribe (ezvcard.io.scribe.SkipMeScribe)4 TelUri (ezvcard.util.TelUri)4 Label (ezvcard.property.Label)3 StreamReader (ezvcard.io.StreamReader)2 Categories (ezvcard.property.Categories)2 Utf8Writer (ezvcard.util.Utf8Writer)2 File (java.io.File)2