SourceDescriptionMapper mapper = new SourceDescriptionMapper();
mapper.toOrganization(dqRepository, result);
assertNotNull(result.getOrganizations());
assertEquals(result.getOrganizations().size(), 1);
Agent gedxOrganization = result.getOrganizations().get(0);
assertNotNull(gedxOrganization);
assertNull(gedxOrganization.getAccounts());
assertNull(gedxOrganization.getExtensionElements());
assertNull(gedxOrganization.getOpenid());
// REPO
assertEquals(gedxOrganization.getId(), "REPO3");
// NAME
assertEquals(gedxOrganization.getName().getValue(), "MyCorporation, Inc.");
// ADDR
assertNotNull(gedxOrganization.getAddresses());
assertEquals(gedxOrganization.getAddresses().size(), 1);
for (Address address : gedxOrganization.getAddresses()) {
assertEquals(address.getValue()
, "5000 MyCorpCampus Dr\n" +
"Hometown, ZZ 99999\n" +
"United States");
assertEquals(address.getStreet(), "__ADR1_VALUE__");
assertEquals(address.getStreet2(), "__ADR2_VALUE__");
assertEquals(address.getStreet3(), "5000 MyCorpCampus Dr");
assertEquals(address.getCity(), "Hometown");
assertEquals(address.getStateOrProvince(), "ZZ");
assertEquals(address.getPostalCode(), "99999");
assertEquals(address.getCountry(), "United States");
}
// EMAIL
assertNotNull(gedxOrganization.getEmails());
assertEquals(gedxOrganization.getEmails().size(), 1);
ResourceReference email = gedxOrganization.getEmails().get(0);
assertNotNull(email.getResource());
assertEquals(email.getResource().toString(), "mailto:info@mycorporation.com");
// PHON and FAX
assertNotNull(gedxOrganization.getPhones());
assertEquals(gedxOrganization.getPhones().size(), 2);
for (ResourceReference phone : gedxOrganization.getPhones()) {
assertNotNull(phone.getResource());
String s = phone.getResource().toString();
if (s.startsWith("data:,Phone%3A%20")) {
assertEquals(s, "data:,Phone%3A%20866-000-0000");
} else if (s.startsWith("data:,Fax%3A%20")) {
assertEquals(s, "data:,Fax%3A%20866-111-1111");
} else {
fail("Unexpected phone: " + s);
}
}
// WWW
assertNotNull(gedxOrganization.getHomepage());
assertEquals(gedxOrganization.getHomepage().getResource().toString(), "https://www.mycorporation.com/");
}