tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agr...@apache.org
Subject svn commit: r551848 - /incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataObject/DataObjectTest.java
Date Fri, 29 Jun 2007 11:00:33 GMT
Author: agrove
Date: Fri Jun 29 04:00:29 2007
New Revision: 551848

URL: http://svn.apache.org/viewvc?view=rev&rev=551848
Log:
new test case to check that get<T>() returns suitable default values for unset open
content property

Modified:
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataObject/DataObjectTest.java

Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataObject/DataObjectTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataObject/DataObjectTest.java?view=diff&rev=551848&r1=551847&r2=551848
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataObject/DataObjectTest.java
(original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataObject/DataObjectTest.java
Fri Jun 29 04:00:29 2007
@@ -300,6 +300,34 @@
         }
     }
 
+    @Test
+    public void testOpenTypeBadPropertyReturnsDefault() {
+        // define an open type with no properties
+        HelperContext helperContext = getScope();
+        String typeName = getTypeName();
+        DataObject typeDef = CTSUtil.createTypeDef("", typeName, true, helperContext);
+        helperContext.getTypeHelper().define(typeDef);
+
+        // create a DataObject that uses this type
+        DataObject testDO = helperContext.getDataFactory().create("", typeName);
+
+        // get() should not throw an exception but return an appropriate default value
+        assertEquals( null, testDO.get( "foo" ) );
+        assertEquals( null, testDO.getDataObject( "foo" ) );
+        assertEquals( null, testDO.getList( "foo" ) );
+        assertEquals( null, testDO.getString( "foo" ) );
+        assertEquals( null, testDO.getBigDecimal( "foo" ) );
+        assertEquals( null, testDO.getBigInteger( "foo" ) );
+        assertEquals( null, testDO.getDate( "foo" ) );
+        assertEquals( null, testDO.getBytes( "foo" ) );
+        assertEquals( (byte) 0, testDO.getByte( "foo" ) );
+        assertEquals( (short) 0, testDO.getShort( "foo" ) );
+        assertEquals( (int) 0, testDO.getInt( "foo" ) );
+        assertEquals( (long) 0, testDO.getLong( "foo" ) );
+        assertEquals( (double) 0, testDO.getDouble( "foo" ) );
+        assertEquals( (float) 0, testDO.getFloat( "foo" ) );
+    }
+
     /**
      * Creates a unique type name for each test so that the types won't clash if an implementation
      * provides its default HelperContext when running the tests.



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message