use of ezvcard.VCardVersion in project ez-vcard by mangstadt.
the class VCardReaderTest method warnings_in_nested_vcard.
@Test
public void warnings_in_nested_vcard() throws Exception {
for (VCardVersion version : VCardVersion.values()) {
// @formatter:off
String str = "BEGIN:VCARD\r\n" + "VERSION:" + version + "\r\n" + "AGENT:\r\n" + "BEGIN:VCARD\r\n" + "VERSION:" + version + "\r\n" + "WARNINGS:value\r\n" + "END:VCARD\r\n" + "END:VCARD\r\n";
// @formatter:on
VCardReader reader = new VCardReader(str);
reader.registerScribe(new WarningsScribe());
reader.readNext();
assertParseWarnings(reader, (Integer) null);
assertNoMoreVCards(reader);
}
}
use of ezvcard.VCardVersion 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.VCardVersion in project ez-vcard by mangstadt.
the class VCardReaderTest method extended_properties_override_standard_property_scribes.
@Test
public void extended_properties_override_standard_property_scribes() throws Exception {
for (VCardVersion version : VCardVersion.values()) {
// @formatter:off
String str = "BEGIN:VCARD\r\n" + "VERSION:" + version + "\r\n" + "FN:John Doe\r\n" + "END:VCARD\r\n";
// @formatter:on
VCardReader reader = new VCardReader(str);
reader.registerScribe(new MyFormattedNameScribe());
VCard vcard = reader.readNext();
assertVersion(version, vcard);
assertPropertyCount(1, vcard);
// read a type that has a type class
MyFormattedNameProperty fn = vcard.getProperty(MyFormattedNameProperty.class);
assertEquals("JOHN DOE", fn.value);
assertParseWarnings(reader);
assertNoMoreVCards(reader);
}
}
use of ezvcard.VCardVersion 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
}
}
use of ezvcard.VCardVersion in project ez-vcard by mangstadt.
the class VCardReaderTest method label_properties.
/**
* LABEL properties should be assigned to an ADR and stored in the
* "Address.getLabel()" field. LABELs that could not be assigned to an ADR
* should go in "VCard.getOrphanedLabels()".
*/
@Test
public void label_properties() throws Exception {
for (VCardVersion version : VCardVersion.values()) {
// @formatter:off
VCardAsserter asserter = read("BEGIN:VCARD\r\n" + "VERSION:" + version.getVersion() + "\r\n" + "ADR;TYPE=home;TYPE=parcel:;;123 Main St.;Austin;TX;91827;USA\r\n" + "LABEL;TYPE=parcel;TYPE=home:123 Main St.\\nAustin\\, TX 91827\\nUSA\r\n" + "ADR;TYPE=work:;;200 Broadway;New York;NY;12345;USA\r\n" + "LABEL;TYPE=parcel:200 Broadway\\nNew York\\, NY 12345\\nUSA\r\n" + "END:VCARD\r\n");
asserter.next(version);
asserter.address().streetAddress("123 Main St.").locality("Austin").region("TX").postalCode("91827").country("USA").label("123 Main St." + NEWLINE + "Austin, TX 91827" + NEWLINE + "USA").types(AddressType.HOME, AddressType.PARCEL).next().streetAddress("200 Broadway").locality("New York").region("NY").postalCode("12345").country("USA").types(AddressType.WORK).noMore();
asserter.simpleProperty(Label.class).value("200 Broadway" + NEWLINE + "New York, NY 12345" + NEWLINE + "USA").param("TYPE", "parcel").noMore();
asserter.done();
// @formatter:on
}
}
Aggregations