use of org.opengis.metadata.citation.Contact in project sis by apache.
the class DefaultCitationTest method testUnmarshalling.
/**
* Tests XML unmarshalling for a metadata version.
* The version is not specified since it should be detected automatically.
*
* @param file file containing the metadata to unmarshal.
*/
private void testUnmarshalling(final String file) throws JAXBException {
final DefaultCitation c = unmarshalFile(DefaultCitation.class, file);
assertTitleEquals("title", "Fight against poverty", c);
final CitationDate date = getSingleton(c.getDates());
assertEquals("date", date.getDate(), TestUtilities.date("2015-10-17 00:00:00"));
assertEquals("dateType", DateType.valueOf("adopted"), date.getDateType());
assertEquals("presentationForm", PresentationForm.valueOf("physicalObject"), getSingleton(c.getPresentationForms()));
final Iterator<ResponsibleParty> it = c.getCitedResponsibleParties().iterator();
final Contact contact = assertResponsibilityEquals(Role.ORIGINATOR, "Maid Marian", it.next());
assertEquals("Contact instruction", "Send carrier pigeon.", String.valueOf(contact.getContactInstructions()));
final OnlineResource resource = contact.getOnlineResource();
assertEquals("Resource name", "IP over Avian Carriers", String.valueOf(resource.getName()));
assertEquals("Resource description", "High delay, low throughput, and low altitude service.", String.valueOf(resource.getDescription()));
assertEquals("Resource linkage", "https://tools.ietf.org/html/rfc1149", String.valueOf(resource.getLinkage()));
assertEquals("Resource function", OnLineFunction.OFFLINE_ACCESS, resource.getFunction());
// Thanks to xlink:href, the Contact shall be the same instance as above.
assertSame("contact", contact, assertResponsibilityEquals(Role.valueOf("funder"), "Robin Hood", it.next()));
assertFalse(it.hasNext());
}
Aggregations