*/
@Test
public void testIdentifierMap() {
final DefaultCitation citation = new DefaultCitation();
final Collection<Identifier> identifiers = citation.getIdentifiers();
final IdentifierMap identifierMap = citation.getIdentifierMap();
assertTrue("Expected an initially empty set of identifiers.", identifiers.isEmpty());
/*
* Set the ISBN code, and ensure that the the ISBN is reflected in the identifier map.
*/
citation.setISBN("MyISBN");
assertEquals("MyISBN", citation.getISBN());
assertEquals("ISBN code shall be included in the set of identifiers.", 1, identifiers.size());
assertEquals("{ISBN=“MyISBN”}", identifierMap.toString());
/*
* Set the identifiers with a list containing ISBN and ISSN codes.
* The ISBN code shall be ignored because and ISBN property was already set.
* The ISSN code shall be retained because it is a new code.
*/
assertNull("ISSN shall be initially null.", citation.getISSN());
citation.setIdentifiers(Arrays.asList(
new DefaultIdentifier(HardCodedCitations.OGC, "MyOGC"),
new DefaultIdentifier(HardCodedCitations.EPSG, "MyEPSG"),
new DefaultIdentifier(Citations.ISBN, "MyIgnored"),
new DefaultIdentifier(Citations.ISSN, "MyISSN")));
assertEquals("The ISBN value shall not have been overwritten.", "MyISBN", citation.getISBN());
assertEquals("The ISSN value shall have been added, because new.", "MyISSN", citation.getISSN());
assertEquals("{OGC=“MyOGC”, EPSG=“MyEPSG”, ISSN=“MyISSN”, ISBN=“MyISBN”}", identifierMap.toString());
}