You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2013/05/02 23:17:51 UTC
svn commit: r1478560 -
/sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTreeChildrenTest.java
Author: desruisseaux
Date: Thu May 2 21:17:39 2013
New Revision: 1478560
URL: http://svn.apache.org/r1478560
Log:
Test iteration over all possible children, including properties without value.
Modified:
sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTreeChildrenTest.java
Modified: sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTreeChildrenTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTreeChildrenTest.java?rev=1478560&r1=1478559&r2=1478560&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTreeChildrenTest.java [UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTreeChildrenTest.java [UTF-8] Thu May 2 21:17:39 2013
@@ -280,6 +280,36 @@ public final strictfp class MetadataTree
assertTrue(citation.getAlternateTitles().isEmpty());
}
+ /**
+ * Tests the children list with the {@link ValueExistencePolicy#ALL}.
+ */
+ @Test
+ @DependsOnMethod("testReadOnlyWithMultiOccurrences")
+ public void testShowAll() {
+ final DefaultCitation citation = metadataWithMultiOccurrences();
+ final MetadataTreeChildren children = create(citation, ValueExistencePolicy.ALL);
+ final String[] expected = {
+ "Some title",
+ "First alternate title",
+ "Second alternate title",
+ null, // dates (collection)
+ "Some edition",
+ null, // edition date
+ null, // identifiers (collection)
+ null, // cited responsibly parties (collection)
+ "PresentationForm[MAP_DIGITAL]",
+ "PresentationForm[MAP_HARDCOPY]",
+ null, // series
+ "Some other details",
+ null, // collective title
+ null, // ISBN
+ null // ISSN
+ };
+ assertFalse ("isEmpty()", children.isEmpty());
+ assertEquals("size()", expected.length, children.size());
+ assertAllNextEqual(expected, children.iterator());
+ }
+
// ------------------------ Support methods for the above tests ------------------------
@@ -291,7 +321,8 @@ public final strictfp class MetadataTree
* because the purpose of this class is not to test {@link MetadataTreeNode}.</p>
*/
private static String valueOf(final TreeTable.Node node) {
- return String.valueOf(node.getUserObject());
+ final Object value = node.getUserObject();
+ return (value != null) ? value.toString() : null;
}
/**