use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class TreeNodeTest method testGetNameForMultiOccurrences.
/**
* Tests {@link TreeNode#getName()} on a metadata with more than one entry in collections.
* Those names <em>shall</em> contain numbering like <cite>"(1 of 2)"</cite>.
*/
@Test
@DependsOnMethod("testGetNameForSingleton")
public void testGetNameForMultiOccurrences() {
final DefaultCitation citation = TreeNodeChildrenTest.metadataWithMultiOccurrences();
assertColumnContentEquals(create(citation, Citation.class), TableColumn.NAME, "Citation", "Title", "Alternate title (1 of 2)", "Alternate title (2 of 2)", "Edition", "Presentation form (1 of 2)", "Presentation form (2 of 2)", "Other citation details");
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class TreeTableViewTest method testSerialization.
/**
* Tests serialization.
*
* @throws Exception if an error occurred during the serialization process.
*/
@Test
@DependsOnMethod("testToString")
public void testSerialization() throws Exception {
final Object original = create(ValueExistencePolicy.COMPACT);
final Object deserialized;
final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
try (ObjectOutputStream out = new ObjectOutputStream(buffer)) {
out.writeObject(original);
}
// Now reads the object we just serialized.
final byte[] data = buffer.toByteArray();
try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(data))) {
deserialized = in.readObject();
}
assertMultilinesEquals(EXPECTED, formatNameAndValue((TreeTableView) deserialized));
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class CitationsTest method testGetCodeSpace.
/**
* Tests {@link Citations#getCodeSpace(Citation)} with some ignorable characters.
* Ignorable character used in this test are:
*
* <ul>
* <li>200B: zero width space</li>
* <li>2060: word joiner</li>
* </ul>
*/
@Test
@DependsOnMethod("testGetIdentifier")
public void testGetCodeSpace() {
final SimpleCitation citation = new SimpleCitation(" Valid\u2060Id\u200Bentifier ");
assertEquals("ValidIdentifier", Citations.getCodeSpace(citation));
assertNull("Shall not be taken as a valid identifier.", Citations.getCodeSpace(new SimpleCitation("Proj.4")));
assertEquals("Shall fallback on the the identifier space name.", "TheProj4Space", Citations.getCodeSpace(new Proj4()));
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class DefaultLineageTest method testLegacySourceImagery.
/**
* Tests the marshalling of a legacy {@code "gmi:LE_Source"} element.
* This test starts with the same metadata than {@link #testLegacySource()} and adds
* an ISO 19115-2 specific property. Consequently the XML name, which was originally
* {@code "gmd:LI_Source"}, shall become {@code "gmi:LE_Source"}.
*
* @throws JAXBException if an error occurred while marshalling the XML.
*/
@Test
@DependsOnMethod("testLegacySource")
public void testLegacySourceImagery() throws JAXBException {
String actual = marshal(create(true), VERSION_2007);
assertXmlEquals("<gmd:LI_Lineage xmlns:gmd=\"" + LegacyNamespaces.GMD + '"' + " xmlns:gmi=\"" + LegacyNamespaces.GMI + '"' + " xmlns:gco=\"" + LegacyNamespaces.GCO + "\">\n" + " <gmd:source>\n" + " <gmi:LE_Source>\n" + " <gmd:description>\n" + " <gco:CharacterString>Description of source data level.</gco:CharacterString>\n" + " </gmd:description>\n" + " <gmi:processedLevel>\n" + " <gmd:MD_Identifier>\n" + " <gmd:code>\n" + " <gco:CharacterString>DummyLevel</gco:CharacterString>\n" + " </gmd:code>\n" + " </gmd:MD_Identifier>\n" + " </gmi:processedLevel>\n" + " </gmi:LE_Source>\n" + " </gmd:source>\n" + "</gmd:LI_Lineage>", actual, "xmlns:*");
verify(unmarshal(DefaultLineage.class, actual));
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class LanguageCodeTest method testLanguageCodeWithoutAttributes.
/**
* Tests the unmarshalling using the {@code <gmd:LanguageCode>} construct without attributes.
* The adapter is expected to parse the element value. XML fragment:
*
* {@preformat xml
* <gmd:MD_Metadata>
* <gmd:language>
* <gmd:LanguageCode>jpn</gmd:LanguageCode>
* </gmd:language>
* </gmd:MD_Metadata>
* }
*
* @throws JAXBException if an error occurs while unmarshalling the language.
*/
@Test
@DependsOnMethod("testMarshalLanguageCode")
public void testLanguageCodeWithoutAttributes() throws JAXBException {
final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
final String xml = getMetadataXML(LANGUAGE_CODE_WITHOUT_ATTRIBUTE);
final Metadata metadata = (Metadata) unmarshal(unmarshaller, xml);
assertEquals(Locale.JAPANESE, metadata.getLanguage());
pool.recycle(unmarshaller);
}
Aggregations