//ADR
{
List<AdrType> it = vcard.getAdrs();
assertEquals(2, it.size());
AdrType f = it.get(0);
assertEquals("item3", f.getGroup());
assertEquals("", f.getPostOfficeBox());
assertEquals("", f.getExtendedAddress());
assertEquals("Silicon Alley 5,", f.getStreetAddress());
assertEquals("New York", f.getLocality());
assertEquals("New York", f.getRegion());
assertEquals("12345", f.getPostalCode());
assertEquals("United States of America", f.getCountryName());
List<AdrParamType> paramTypes = f.getParams();
assertEquals(2, paramTypes.size());
assertTrue(paramTypes.contains(AdrParamType.HOME));
assertTrue(paramTypes.contains(AdrParamType.PREF));
f = it.get(1);
assertEquals("item4", f.getGroup());
assertEquals("", f.getPostOfficeBox());
assertEquals("", f.getExtendedAddress());
assertEquals("Street4\nBuilding 6\nFloor 8", f.getStreetAddress());
assertEquals("New York", f.getLocality());
assertEquals("", f.getRegion());
assertEquals("12345", f.getPostalCode());
assertEquals("USA", f.getCountryName());
paramTypes = f.getParams();
assertEquals(1, paramTypes.size());
assertTrue(paramTypes.contains(AdrParamType.WORK));
}
//URL
{
List<UrlType> it = vcard.getUrls();
assertEquals(1, it.size());
UrlType f = it.get(0);
assertEquals("item5", f.getGroup());
assertEquals("http://www.ibm.com", f.getRawUrl());
List<UrlParamType> types = f.getParams();
assertEquals(1, types.size());
assertTrue(types.contains(UrlParamType.PREF));
}
//BDAY
{
BDayType f = vcard.getBDay();
assertEquals(2012, f.getBirthday().get(Calendar.YEAR));
assertEquals(Calendar.JUNE, f.getBirthday().get(Calendar.MONTH));
assertEquals(6, f.getBirthday().get(Calendar.DAY_OF_MONTH));
assertEquals(ISOFormat.ISO8601_DATE_EXTENDED, f.getISO8601Format());
}
//PHOTO
{
List<PhotoType> it = vcard.getPhotos();
assertEquals(1, it.size());
PhotoType f = it.get(0);
assertEquals(EncodingType.BINARY, f.getEncodingType());
assertEquals(ImageMediaType.JPEG, f.getImageMediaType());
assertEquals(32531, f.getPhoto().length);
}
//custom types
{
List<ExtendedType> it = vcard.getExtendedTypes();
assertEquals(4, it.size());
ExtendedType f = it.get(0);
assertEquals("item2", f.getGroup());
assertEquals("X-ABLABEL", f.getExtendedName());
assertEquals("_$!<AssistantPhone>!$_", f.getExtendedValue());
f = it.get(1);
assertEquals("item3", f.getGroup());
assertEquals("X-ABADR", f.getExtendedName());
assertEquals("Silicon Alley", f.getExtendedValue());
f = it.get(2);
assertEquals("item4", f.getGroup());
assertEquals("X-ABADR", f.getExtendedName());
assertEquals("Street 4, Building 6,\n Floor 8\nNew York\nUSA", f.getExtendedValue());
f = it.get(3);
assertEquals("item5", f.getGroup());
assertEquals("X-ABLABEL", f.getExtendedName());
assertEquals("_$!<HomePage>!$_", f.getExtendedValue());
}
VCardImpl vcard2 = (VCardImpl)vcard;
if(vcard2.hasErrors()) {