use of ezvcard.property.asserter.VCardAsserter in project ez-vcard by mangstadt.
the class SampleVCardsTest method gmailList.
@Test
public void gmailList() throws Throwable {
VCardAsserter asserter = read("gmail-list.vcf");
{
asserter.next(V3_0);
// @formatter:off
asserter.simpleProperty(FormattedName.class).value("Arnold Smith").noMore();
asserter.structuredName().family("Smith").given("Arnold").noMore();
asserter.email().types(EmailType.INTERNET).value("asmithk@gmail.com").noMore();
// @formatter:on
asserter.validate().run();
}
{
asserter.next(V3_0);
// @formatter:off
asserter.simpleProperty(FormattedName.class).value("Chris Beatle").noMore();
asserter.structuredName().family("Beatle").given("Chris").noMore();
asserter.email().types(EmailType.INTERNET).value("chrisy55d@yahoo.com").noMore();
// @formatter:on
asserter.validate().run();
}
{
asserter.next(V3_0);
// @formatter:off
asserter.simpleProperty(FormattedName.class).value("Doug White").noMore();
asserter.structuredName().family("White").given("Doug").noMore();
asserter.email().types(EmailType.INTERNET).value("dwhite@gmail.com").noMore();
// @formatter:on
asserter.validate().run();
}
asserter.done();
}
use of ezvcard.property.asserter.VCardAsserter in project ez-vcard by mangstadt.
the class SampleVCardsTest method rfc6350_example.
@Test
public void rfc6350_example() throws Throwable {
VCardAsserter asserter = read("rfc6350-example.vcf");
asserter.next(V4_0);
// @formatter:off
asserter.simpleProperty(FormattedName.class).value("Simon Perreault").noMore();
asserter.structuredName().family("Perreault").given("Simon").suffixes("ing. jr", "M.Sc.").noMore();
asserter.dateProperty(Birthday.class).partialDate(PartialDate.builder().month(2).date(3).build()).noMore();
asserter.dateProperty(Anniversary.class).partialDate(PartialDate.builder().year(2009).month(8).date(8).hour(14).minute(30).offset(new UtcOffset(false, -5, 0)).build()).noMore();
asserter.property(Gender.class).expected(Gender.male()).noMore();
asserter.simpleProperty(Language.class).value("fr").param("PREF", "1").next().value("en").param("PREF", "2").noMore();
asserter.listProperty(Organization.class).param("TYPE", "work").values("Viagenie").noMore();
asserter.address().extendedAddress("Suite D2-630").streetAddress("2875 Laurier").locality("Quebec").region("QC").postalCode("G1V 2M2").country("Canada").types(AddressType.WORK).noMore();
asserter.telephone().types(TelephoneType.WORK, TelephoneType.VOICE).uri(new TelUri.Builder("+1-418-656-9254").extension("102").build()).param("PREF", "1").next().types(TelephoneType.WORK, TelephoneType.CELL, TelephoneType.VOICE, TelephoneType.VIDEO, TelephoneType.TEXT).uri(new TelUri.Builder("+1-418-262-6501").build()).noMore();
asserter.email().types(EmailType.WORK).value("simon.perreault@viagenie.ca").noMore();
asserter.geo().latitude(46.772673).longitude(-71.282945).param("TYPE", "work").noMore();
asserter.binaryProperty(Key.class).url("http://www.viagenie.ca/simon.perreault/simon.asc").param("TYPE", "work").noMore();
asserter.timezone().offset(new UtcOffset(false, -5, 0)).noMore();
asserter.simpleProperty(Url.class).value("http://nomis80.org").param("TYPE", "home").noMore();
// @formatter:on
asserter.validate().run();
asserter.done();
}
use of ezvcard.property.asserter.VCardAsserter in project ez-vcard by mangstadt.
the class VCardReaderTest method invalid_line.
@Test
public void invalid_line() throws Exception {
for (VCardVersion version : VCardVersion.values()) {
// @formatter:off
VCardAsserter asserter = read("BEGIN:VCARD\r\n" + "VERSION:" + version + "\r\n" + "bad-line\r\n" + "END:VCARD\r\n");
// @formatter:on
asserter.next(version);
asserter.warnings(27);
asserter.done();
}
}
use of ezvcard.property.asserter.VCardAsserter in project ez-vcard by mangstadt.
the class VCardReaderTest method warnings_list_cleared.
@Test
public void warnings_list_cleared() throws Exception {
for (VCardVersion version : VCardVersion.values()) {
// @formatter:off
VCardAsserter asserter = read("BEGIN:VCARD\r\n" + "VERSION:" + version + "\r\n" + "bad-line\r\n" + "END:VCARD\r\n" + "BEGIN:VCARD\r\n" + "VERSION:" + version + "\r\n" + "END:VCARD\r\n");
// @formatter:on
asserter.next(version);
asserter.warnings(27);
asserter.next(version);
asserter.done();
}
}
use of ezvcard.property.asserter.VCardAsserter in project ez-vcard by mangstadt.
the class VCardReaderTest method skip_non_vcard_components.
@Test
public void skip_non_vcard_components() throws Exception {
for (VCardVersion version : VCardVersion.values()) {
// @formatter:off
VCardAsserter asserter = read("BEGIN:VCALENDAR\r\n" + "VERSION:2.0\r\n" + "invalid line--warning should not be logged\r\n" + "PRODID:-//Company//Application//EN\r\n" + "END:VCALENDAR\r\n" + "invalid line--warning should not be logged\r\n" + "BEGIN:VCARD\r\n" + "VERSION:" + version + "\r\n" + "FN:John Doe\r\n" + "END:VCARD\r\n");
asserter.next(version);
asserter.simpleProperty(FormattedName.class).value("John Doe").noMore();
asserter.done();
// @formatter:on
}
}
Aggregations