sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1478560 - /sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataTreeChildrenTest.java
Date Thu, 02 May 2013 21:17:51 GMT
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;
     }
 
     /**



Mime
View raw message