Search in sources :

Example 66 with VCardAsserter

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

the class HCardParserTest method mailto_url_with_email_and_url_class_names.

@Test
public void mailto_url_with_email_and_url_class_names() throws Exception {
    // @formatter:off
    VCardAsserter asserter = readHtml("<html>" + "<body>" + "<div class=\"vcard\">" + "<a class=\"email url\" href=\"mailto:jdoe@hotmail.com\">Email me</a>" + "</div>" + "</body>" + "</html>");
    asserter.next(V3_0);
    asserter.simpleProperty(Url.class).value("mailto:jdoe@hotmail.com").noMore();
    asserter.email().value("jdoe@hotmail.com").noMore();
    asserter.done();
// @formatter:on
}
Also used : VCardAsserter(ezvcard.property.asserter.VCardAsserter) Test(org.junit.Test)

Example 67 with VCardAsserter

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

the class HCardParserTest method complete_vcard.

@Test
public void complete_vcard() throws Exception {
    // @formatter:off
    VCardAsserter asserter = readHtml("<html>" + "<body>" + "<div class=\"vcard\">" + "<a class=\"fn org url\" href=\"http://www.commerce.net/\">CommerceNet</a>" + "<div class=\"adr\">" + "<span class=\"type\">Work</span>:" + "<div class=\"street-address\">169 University Avenue</div>" + "<span class=\"locality\">Palo Alto</span>,  " + "<abbr class=\"region\" title=\"California\">CA</abbr>&nbsp;&nbsp;" + "<span class=\"postal-code\">94301</span>" + "<div class=\"country-name\">USA</div>" + "</div>" + "<div class=\"tel\">" + "<span class=\"type\">Work</span> +1-650-289-4040" + "</div>" + "<div class=\"tel\">" + "<span class=\"type\">Fax</span> +1-650-289-4041" + "</div>" + "<div>Email:" + "<span class=\"email\">info@commerce.net</span>" + "</div>" + "</div>" + "</body>" + "</html>");
    asserter.next(V3_0);
    asserter.simpleProperty(FormattedName.class).value("CommerceNet").noMore();
    asserter.listProperty(Organization.class).values("CommerceNet").noMore();
    asserter.simpleProperty(Url.class).value("http://www.commerce.net/").noMore();
    asserter.address().types(AddressType.WORK).streetAddress("169 University Avenue").locality("Palo Alto").region("California").postalCode("94301").country("USA").noMore();
    asserter.telephone().types(TelephoneType.WORK).text("+1-650-289-4040").next().types(TelephoneType.FAX).text("+1-650-289-4041").noMore();
    asserter.email().value("info@commerce.net").noMore();
    asserter.done();
// @formatter:on
}
Also used : VCardAsserter(ezvcard.property.asserter.VCardAsserter) Test(org.junit.Test)

Example 68 with VCardAsserter

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

the class HCardParserTest method empty_vcard.

@Test
public void empty_vcard() throws Exception {
    // @formatter:off
    VCardAsserter asserter = readHtml("<html>" + "<body>" + "<div class=\"vcard\" />" + "</body>" + "</html>");
    // @formatter:on
    asserter.next(V3_0);
    asserter.done();
}
Also used : VCardAsserter(ezvcard.property.asserter.VCardAsserter) Test(org.junit.Test)

Example 69 with VCardAsserter

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

the class HCardParserTest method convert_mailto_urls_to_email_types.

@Test
public void convert_mailto_urls_to_email_types() throws Exception {
    // @formatter:off
    VCardAsserter asserter = readHtml("<html>" + "<body>" + "<div class=\"vcard\">" + "<a class=\"url\" href=\"mailto:jdoe@hotmail.com\">Email me</a>" + "</div>" + "</body>" + "</html>");
    asserter.next(V3_0);
    asserter.email().value("jdoe@hotmail.com").noMore();
    asserter.done();
// @formatter:on
}
Also used : VCardAsserter(ezvcard.property.asserter.VCardAsserter) Test(org.junit.Test)

Example 70 with VCardAsserter

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

the class HCardParserTest method case_insensitive_property_names.

@Test
public void case_insensitive_property_names() throws Exception {
    // @formatter:off
    VCardAsserter asserter = readHtml("<html>" + "<body>" + "<div class=\"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)

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