Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added asObjSeq method

  • Loading branch information...
commit 020e86e4d9a39f1fb79f1aebb9346537e4bc1582 1 parent 44e7c7d
michelegonella authored
22 zen-dataobject/src/test/java/com/nominanuda/dataobject/DataStructHelperTest.java
View
@@ -23,6 +23,7 @@
import org.junit.*;
import org.xml.sax.*;
+import static com.nominanuda.dataobject.DataStructHelper.STRUCT;
public class DataStructHelperTest {
@@ -89,6 +90,25 @@ public void shouldTranslateDataArrayWith2EqualsObjectIntoAListWith2EqualsMap() {
assertEquals(2, list.size());
assertEquals(list.get(0), list.get(1));
}
-
+
+ @Test
+ public void testSaObjSeq() {
+ DataArray a0 = STRUCT.newArray();
+ DataArray a1 = STRUCT.newArray().with(STRUCT.newObject());
+ DataArray a2 = STRUCT.newArray().with("");
+
+ for(DataObject o : STRUCT.asObjSeq(a0)) {
+ assertFalse(o.exists("foo"));
+ }
+ for(DataObject o : STRUCT.asObjSeq(a1)) {
+ assertFalse(o.exists("foo"));
+ }
+ try {
+ for(DataObject o : STRUCT.asObjSeq(a2)) {
+ assertFalse(o.exists("foo"));
+ }
+ fail();
+ } catch(ClassCastException e) {}
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.