summaryrefslogtreecommitdiffstats
path: root/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/TypeConversionTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/TypeConversionTest.java')
-rw-r--r--sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/TypeConversionTest.java3583
1 files changed, 3583 insertions, 0 deletions
diff --git a/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/TypeConversionTest.java b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/TypeConversionTest.java
new file mode 100644
index 0000000000..21abeb1aba
--- /dev/null
+++ b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/TypeConversionTest.java
@@ -0,0 +1,3583 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package test.sdo21.tests.conversion;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Date;
+
+
+import commonj.sdo.DataObject;
+
+/**
+ * This test case primarily tests the type conversion matrix in section 16 of
+ * the specification. There are tests for valid and invalid type conversions.
+ * Invalid type conversions are expected to throw a ClassCastException as per
+ * section 3.1.13 of the specification. Some of the tests perform conversions
+ * that result in loss of information e.g. getting a double property by calling
+ * getShort(). Type conversions should follow the rules of the Java language and
+ * are allowed to lose information (section 3.1.3)
+ *
+ * TODO there is overlap between this test and {@link TypeConversionTest2} which
+ * needs to be resolved
+ */
+
+// TODO: could use expected exception function of test annotation
+public class TypeConversionTest extends ConversionBase {
+
+ public TypeConversionTest(String string) {
+ super(string);
+ }
+
+ /**
+ * DataObject class test. Testing getting byte from DataObject with type
+ * boolean
+ */
+ public void testBooleanGetTypeConversionByte() {
+ DataObject product = createBooleanObject(true);
+ try {// to byte
+ product.getByte("boolVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting char from DataObject with type
+ * boolean
+ */
+ public void testBooleanGetTypeConversionChar() {
+ DataObject product = createBooleanObject(true);
+ try {// to char
+ product.getChar("boolVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting double from DataObject with type
+ * boolean
+ */
+ public void testBooleanGetTypeConversionDouble() {
+ DataObject product = createBooleanObject(true);
+ try {// to double
+ product.getDouble("boolVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting float from DataObject with type
+ * boolean
+ */
+ public void testBooleanGetTypeConversionFloat() {
+ DataObject product = createBooleanObject(true);
+ try {// to float
+ product.getFloat("boolVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting int from DataObject with type
+ * boolean
+ */
+ public void testBooleanGetTypeConversionInt() {
+ DataObject product = createBooleanObject(true);
+ try {
+ product.getInt("boolVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting long from DataObject with type
+ * boolean
+ */
+ public void testBooleanGetTypeConversionLong() {
+ DataObject product = createBooleanObject(true);
+ try {// to long
+ product.getLong("boolVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting short from DataObject with type
+ * boolean
+ */
+ public void testBooleanGetTypeConversionShort() {
+ DataObject product = createBooleanObject(true);
+ try {// to short
+ product.getShort("boolVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting bytes[] from DataObject with type
+ * boolean
+ */
+ public void testBooleanGetTypeConversionBytes() {
+ DataObject product = createBooleanObject(true);
+ try {// to bytes[]
+ product.getBytes("boolVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting BigDecimal from DataObject with
+ * type boolean
+ */
+ public void testBooleanGetTypeConversionBigDecimal() {
+ DataObject product = createBooleanObject(true);
+ try {// to BigDecimal
+ product.getBigDecimal("boolVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting BigInteger from DataObject with
+ * type boolean
+ */
+ public void testBooleanGetTypeConversionBigInteger() {
+ DataObject product = createBooleanObject(true);
+ try {// to BigInteger
+ product.getBigInteger("boolVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting Date from DataObject with type
+ * boolean
+ */
+ public void testBooleanGetTypeConversionDate() {
+ DataObject product = createBooleanObject(true);
+ try {// to Date
+ product.getDate("boolVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting boolean from DataObject with type
+ * byte
+ */
+ public void testByteGetTypeConversionBoolean() {
+ DataObject product = createByteObject((byte)5);
+ try {
+ product.getBoolean("byteVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting char from DataObject with type
+ * byte
+ */
+ public void testByteGetTypeConversionChar() {
+ DataObject product = createByteObject((byte)5);
+ try {
+ product.getChar("byteVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting double from DataObject with type
+ * byte
+ */
+ public void testByteGetTypeConversionDouble() {
+ DataObject product = createByteObject((byte)5);
+
+ double doubleVal = product.getDouble("byteVal");
+ assertTrue(doubleVal == 5);
+ }
+
+ /**
+ * DataObject class test. Testing getting float from DataObject with type
+ * byte
+ */
+ public void testByteGetTypeConversionFloat() {
+ DataObject product = createByteObject((byte)5);
+
+ float floatVal = product.getFloat("byteVal");
+ assertTrue(floatVal == 5);
+ }
+
+ /**
+ * DataObject class test. Testing getting int from DataObject with type byte
+ */
+ public void testByteGetTypeConversionInt() {
+ DataObject product = createByteObject((byte)5);
+
+ int intVal = product.getInt("byteVal");
+ assertTrue(intVal == 5);
+ }
+
+ /**
+ * DataObject class test. Testing getting long from DataObject with type
+ * byte
+ */
+ public void testByteGetTypeConversionLong() {
+ DataObject product = createByteObject((byte)5);
+
+ long longVal = product.getLong("byteVal");
+ assertTrue(longVal == 5);
+ }
+
+ /**
+ * DataObject class test. Testing getting short from DataObject with type
+ * byte
+ */
+ public void testByteGetTypeConversionShort() {
+ DataObject product = createByteObject((byte)5);
+
+ short shortVal = product.getShort("byteVal");
+ assertTrue(shortVal == 5);
+ }
+
+ /**
+ * DataObject class test. Testing getting bytes[] from DataObject with type
+ * byte
+ */
+ public void testByteGetTypeConversionBytes() {
+ DataObject product = createByteObject((byte)5);
+ try {
+ product.getBytes("byteVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting BigDecimal from DataObject with
+ * type byte
+ */
+ public void testByteGetTypeConversionBigDecimal() {
+ byte value = 5;
+ DataObject product = createByteObject(value);
+ assertEquals( new BigDecimal(value), product.getBigDecimal("byteVal") );
+ }
+
+ /**
+ * DataObject class test. Testing getting BigInteger from DataObject with
+ * type byte
+ */
+ public void testByteGetTypeConversionBigInteger() {
+ byte value = 5;
+ DataObject product = createByteObject(value);
+ assertEquals( new BigInteger(String.valueOf(value)), product.getBigInteger("byteVal") );
+ }
+
+ /**
+ * DataObject class test. Testing getting Date from DataObject with type
+ * byte
+ */
+ public void testByteGetTypeConversionDate() {
+ DataObject product = createByteObject((byte)5);
+ try {
+ product.getDate("byteVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting boolean from DataObject with type
+ * char
+ */
+ public void testCharGetTypeConversionBoolean() {
+ DataObject product = createCharObject('s');
+ try {
+ product.getBoolean("charVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting byte from DataObject with type
+ * char
+ */
+ public void testCharGetTypeConversionByte() {
+ DataObject product = createCharObject('s');
+ try {
+ product.getByte("charVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting double from DataObject with type
+ * char
+ */
+ public void testCharGetTypeConversionDouble() {
+ DataObject product = createCharObject('s');
+ try {
+ product.getDouble("charVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting float from DataObject with type
+ * char
+ */
+ public void testCharGetTypeConversionFloat() {
+ DataObject product = createCharObject('s');
+ try {
+ product.getFloat("charVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting int from DataObject with type char
+ */
+ public void testCharGetTypeConversionInt() {
+ DataObject product = createCharObject('s');
+ try {
+ product.getInt("charVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting long from DataObject with type
+ * char
+ */
+ public void testCharGetTypeConversionLong() {
+ DataObject product = createCharObject('s');
+ try {
+ product.getLong("charVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting short from DataObject with type
+ * char
+ */
+ public void testCharGetTypeConversionShort() {
+ DataObject product = createCharObject('s');
+ try {
+ product.getShort("charVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting bytes[] from DataObject with type
+ * char
+ */
+ public void testCharGetTypeConversionBytes() {
+ DataObject product = createCharObject('s');
+ try {
+ product.getBytes("charVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting BigDecimal from DataObject with
+ * type char
+ */
+ public void testCharGetTypeConversionBigDecimal() {
+ DataObject product = createCharObject('s');
+ try {
+ product.getBigDecimal("charVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting BigInteger from DataObject with
+ * type char
+ */
+ public void testCharGetTypeConversionBigInteger() {
+ DataObject product = createCharObject('s');
+ try {
+ product.getBigInteger("charVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting Date from DataObject with type
+ * char
+ */
+ public void testCharGetTypeConversionDate() {
+ DataObject product = createCharObject('s');
+ try {
+ product.getDate("charVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting boolean from DataObject with type
+ * double
+ */
+ public void testDoubleGetTypeConversionBoolean() {
+ DataObject product = createDoubleObject(5);
+ try {
+ product.getBoolean("doubleVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting byte from DataObject with type
+ * double
+ */
+ public void testDoubleGetTypeConversionByte() {
+ DataObject product1 = createDoubleObject(5);
+ byte byteVal = product1.getByte("doubleVal");
+ assertEquals(5, byteVal);
+
+ int largeValue = Byte.MAX_VALUE + 1;
+ DataObject product = createDoubleObject(largeValue);
+ byte b = product.getByte("doubleVal");
+ assertEquals((byte)largeValue, b);
+ }
+
+ /**
+ * DataObject class test. Testing getting char from DataObject with type
+ * double
+ */
+ public void testDoubleGetTypeConversionChar() {
+ DataObject product = createDoubleObject(5);
+ try {
+ product.getChar("doubleVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting float from DataObject with type
+ * double
+ */
+ public void testDoubleGetTypeConversionFloat() {
+ DataObject product1 = createDoubleObject(5);
+ float floatVal = product1.getFloat("doubleVal");
+ assertTrue(floatVal == 5.0F);
+
+ double largeValue = ((double)Float.MAX_VALUE) + 1.0;
+ DataObject product = createDoubleObject(largeValue);
+ float f = product.getFloat("doubleVal");
+ assertEquals((float)largeValue, f);
+ }
+
+ /**
+ * DataObject class test. Testing getting int from DataObject with type
+ * double
+ */
+ public void testDoubleGetTypeConversionInt() {
+ DataObject product1 = createDoubleObject(5);
+ int intVal = product1.getInt("doubleVal");
+ assertEquals(5, intVal);
+
+ double largeValue = ((double)Integer.MAX_VALUE) + 1.0;
+ DataObject product = createDoubleObject(largeValue);
+ int value = product.getInt("doubleVal");
+ assertEquals((int)largeValue, value);
+ }
+
+ /**
+ * DataObject class test. Testing getting long from DataObject with type
+ * double
+ */
+ public void testDoubleGetTypeConversionLong() {
+ DataObject product1 = createDoubleObject(5);
+ long longVal = product1.getLong("doubleVal");
+ assertEquals(5, longVal);
+
+ double largeValue = ((double)Long.MAX_VALUE) + 1.0;
+ DataObject product = createDoubleObject(largeValue);
+ long l = product.getLong("doubleVal");
+ assertEquals((long)largeValue, l);
+ }
+
+ /**
+ * DataObject class test. Testing getting short from DataObject with type
+ * double
+ */
+ public void testDoubleGetTypeConversionShort() {
+ DataObject product1 = createDoubleObject(5);
+ short shortVal = product1.getShort("doubleVal");
+ assertEquals(5, shortVal);
+
+ int largeValue = Short.MAX_VALUE + 1;
+ DataObject product = createDoubleObject(largeValue);
+ short s = product.getShort("doubleVal");
+ assertEquals((short)largeValue, s);
+ }
+
+ /**
+ * DataObject class test. Testing getting bytes[] from DataObject with type
+ * double
+ */
+ public void testDoubleGetTypeConversionBytes() {
+ DataObject product = createDoubleObject(5);
+ try {
+ product.getBytes("doubleVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting Bigdecimal from DataObject with
+ * type double
+ */
+ public void testDoubleGetTypeConversionBigDecimal() {
+ DataObject product = createDoubleObject(5);
+
+ BigDecimal bdVal = product.getBigDecimal("doubleVal");
+ assertEquals(5, bdVal.intValue());
+ }
+
+ /**
+ * DataObject class test. Testing getting BigInteger from DataObject with
+ * type double
+ */
+ public void testDoubleGetTypeConversionBigInteger() {
+ DataObject product = createDoubleObject(5);
+
+ BigInteger biVal = product.getBigInteger("doubleVal");
+ assertEquals(5, biVal.intValue());
+ }
+
+ /**
+ * DataObject class test. Testing getting date from DataObject with type
+ * double
+ */
+ public void testDoubleGetTypeConversionDate() {
+ DataObject product = createDoubleObject(5);
+ try {
+ product.getDate("doubleVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting boolean from DataObject with type
+ * float
+ */
+ public void testFloatGetTypeConversionBoolean() {
+ DataObject product = createFloatObject(5);
+ try {
+ product.getBoolean("floatVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting byte from DataObject with type
+ * float
+ */
+ public void testFloatGetTypeConversionByte() {
+ DataObject product1 = createFloatObject(5);
+ byte byteVal = product1.getByte("floatVal");
+ assertEquals(5, byteVal);
+
+ float value = 5.5F;
+ DataObject product = createFloatObject(value);
+ byte b = product.getByte("floatVal");
+ assertEquals((byte)value, b);
+ }
+
+ /**
+ * DataObject class test. Testing getting char from DataObject with type
+ * float
+ */
+ public void testFloatGetTypeConversionChar() {
+ DataObject product = createFloatObject(5);
+ try {
+ product.getChar("floatVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting double from DataObject with type
+ * float
+ */
+ public void testFloatGetTypeConversionDouble() {
+ DataObject product1 = createFloatObject(5);
+ double doubleVal = product1.getDouble("floatVal");
+ assertTrue(doubleVal == 5);
+
+ float value = 5.5F;
+ DataObject product = createFloatObject(value);
+ double d = product.getDouble("floatVal");
+ assertEquals((double)value, d);
+ }
+
+ /**
+ * DataObject class test. Testing getting int from DataObject with type
+ * float
+ */
+ public void testFloatGetTypeConversionInt() {
+ DataObject product1 = createFloatObject(5);
+ int intVal = product1.getInt("floatVal");
+ assertEquals(5, intVal);
+
+ float value = 5.5F;
+ DataObject product = createFloatObject(value);
+ int i = product.getInt("floatVal");
+ assertEquals((int)value, i);
+ }
+
+ /**
+ * DataObject class test. Testing getting long from DataObject with type
+ * float
+ */
+ public void testFloatGetTypeConversionLong() {
+ DataObject product1 = createFloatObject(5);
+ long longVal = product1.getLong("floatVal");
+ assertTrue(longVal == 5);
+
+ float f = 5.5F;
+ DataObject product = createFloatObject(f);
+ long l = product.getLong("floatVal");
+ assertEquals((long)f, l);
+ }
+
+ /**
+ * DataObject class test. Testing getting short from DataObject with type
+ * float
+ */
+ public void testFloatGetTypeConversionShort() {
+
+ DataObject product1 = createFloatObject(5);
+ short shortVal = product1.getShort("floatVal");
+ assertTrue(shortVal == 5);
+
+ float value = 5.5F;
+ DataObject product = createFloatObject(value);
+ short s = product.getShort("floatVal");
+ assertEquals((short)value, s);
+ }
+
+ /**
+ * DataObject class test. Testing getting bytes[] from DataObject with type
+ * float
+ */
+ public void testFloatGetTypeConversionBytes() {
+ DataObject product = createFloatObject(5);
+ try {
+ product.getBytes("floatVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting BigDecimal from DataObject with
+ * type float
+ */
+ public void testFloatGetTypeConversionBigDecimal() {
+ DataObject product = createFloatObject(5.5F);
+ BigDecimal bdval = product.getBigDecimal("floatVal");
+ assertTrue(bdval.floatValue() == 5.5F);
+ }
+
+ /**
+ * DataObject class test. Testing getting BigInteger from DataObject with
+ * type float
+ */
+ public void testFloatGetTypeConversionBigInteger() {
+ DataObject product1 = createFloatObject(5);
+ BigInteger bdval = product1.getBigInteger("floatVal");
+ assertTrue(bdval.intValue() == 5);
+
+ float value = 5.5F;
+ DataObject product = createFloatObject(value);
+ BigInteger big = product.getBigInteger("floatVal");
+ assertEquals(new BigInteger("" + (int)value), big);
+ }
+
+ /**
+ * DataObject class test. Testing getting date from DataObject with type
+ * float
+ */
+ public void testFloatGetTypeConversionDate() {
+ DataObject product = createFloatObject(5);
+ try {
+ product.getDate("floatVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting boolean from DataObject with type
+ * int
+ */
+ public void testIntGetTypeConversionBoolean() {
+ DataObject product = createIntObject(5);
+ try {
+ product.getBoolean("intVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting byte from DataObject with type int
+ */
+ public void testIntGetTypeConversionByte() {
+ DataObject product1 = createIntObject(5);
+ byte byteVal = product1.getByte("intVal");
+ assertTrue(byteVal == 5);
+
+ int value = Byte.MAX_VALUE + 1;
+ DataObject product = createIntObject(value);
+ byte b = product.getByte("intVal");
+ assertEquals((byte)value, b);
+ }
+
+ /**
+ * DataObject class test. Testing getting char from DataObject with type int
+ */
+ public void testIntGetTypeConversionChar() {
+ DataObject product = createIntObject(5);
+ try {
+ product.getChar("intVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting double from DataObject with type
+ * int
+ */
+ public void testIntGetTypeConversionDouble() {
+ DataObject product = createIntObject(5);
+ double doubleVal = product.getDouble("intVal");
+ assertTrue(doubleVal == 5);
+ }
+
+ /**
+ * DataObject class test. Testing getting float from DataObject with type
+ * int
+ */
+ public void testIntGetTypeConversionFloat() {
+ DataObject product1 = createIntObject(5);
+ float floatVal = product1.getFloat("intVal");
+ assertTrue(floatVal == 5);
+ }
+
+ /**
+ * DataObject class test. Testing getting long from DataObject with type int
+ */
+ public void testIntGetTypeConversionLong() {
+ DataObject product = createIntObject(5);
+ long longVal = product.getLong("intVal");
+ assertTrue(longVal == 5);
+ }
+
+ /**
+ * DataObject class test. Testing getting short from DataObject with type
+ * int
+ */
+ public void testIntGetTypeConversionShort() {
+ DataObject product1 = createIntObject(5);
+ short shortVal = product1.getShort("intVal");
+ assertTrue(shortVal == 5);
+
+ int value = Short.MAX_VALUE + 1;
+ DataObject product = createIntObject(value);
+ short s = product.getShort("intVal");
+ assertEquals((short)value, s);
+ }
+
+ /**
+ * DataObject class test. Testing getting bytes[] from DataObject with type
+ * int
+ */
+ public void testIntGetTypeConversionBytes() {
+ DataObject product = createIntObject(5);
+ try {
+ product.getBytes("intVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting BigDecimal from DataObject with
+ * type int
+ */
+ public void testIntGetTypeConversionBigDecimal() {
+ DataObject product1 = createIntObject(5);
+ BigDecimal bdVal = product1.getBigDecimal("intVal");
+ assertTrue(bdVal.intValue() == 5);
+ }
+
+ /**
+ * DataObject class test. Testing getting BigInteger from DataObject with
+ * type int
+ */
+ public void testIntGetTypeConversionBigInteger() {
+ DataObject product = createIntObject(5);
+ BigInteger biVal = product.getBigInteger("intVal");
+ assertTrue(biVal.intValue() == 5);
+ }
+
+ /**
+ * DataObject class test. Testing getting date from DataObject with type int
+ */
+ public void testIntGetTypeConversionDate() {
+ DataObject product = createIntObject(5);
+ try {
+ product.getDate("intVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting boolean from DataObject with type
+ * long
+ */
+ public void testLongGetTypeConversionBoolean() {
+ DataObject product = createLongObject(5);
+ try {
+ product.getBoolean("longVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting byte from DataObject with type
+ * long
+ */
+ public void testLongGetTypeConversionByte() {
+ DataObject product1 = createLongObject(5);
+ byte byteVal = product1.getByte("longVal");
+ assertTrue(byteVal == 5);
+
+ int value = Byte.MAX_VALUE + 1;
+ DataObject product = createLongObject(value);
+ byte b = product.getByte("longVal");
+ assertEquals((byte)value, b);
+ }
+
+ /**
+ * DataObject class test. Testing getting char from DataObject with type
+ * long
+ */
+ public void testLongGetTypeConversionChar() {
+ DataObject product = createLongObject(5);
+ try {
+ product.getChar("longVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting double from DataObject with type
+ * long
+ */
+ public void testLongGetTypeConversionDouble() {
+ DataObject product = createLongObject(5);
+ double doubleVal = product.getDouble("longVal");
+ assertTrue(doubleVal == 5);
+ }
+
+ /**
+ * DataObject class test. Testing getting float from DataObject with type
+ * long
+ */
+ public void testLongGetTypeConversionFloat() {
+ DataObject product1 = createLongObject(5);
+ float floatVal = product1.getFloat("longVal");
+ assertTrue(floatVal == 5);
+ }
+
+ /**
+ * DataObject class test. Testing getting int from DataObject with type long
+ */
+ public void testLongGetTypeConversionInt() {
+ DataObject product1 = createLongObject(5);
+ int intVal = product1.getInt("longVal");
+ assertTrue(intVal == 5);
+
+ long value = Long.MAX_VALUE;
+ DataObject product = createLongObject(value);
+ int i = product.getInt("longVal");
+ assertEquals((int)value, i);
+ }
+
+ /**
+ * DataObject class test. Testing getting short from DataObject with type
+ * long
+ */
+ public void testLongGetTypeConversionShort() {
+ DataObject product1 = createLongObject(5);
+ short shortVal = product1.getByte("longVal");
+ assertTrue(shortVal == 5);
+
+ int value = Short.MAX_VALUE + 1;
+ DataObject product = createLongObject(value);
+ short s = product.getShort("longVal");
+ assertEquals((short)value, s);
+ }
+
+ /**
+ * DataObject class test. Testing getting bytes[] from DataObject with type
+ * long
+ */
+ public void testLongGetTypeConversionBytes() {
+ DataObject product = createLongObject(5);
+ try {
+ product.getBytes("longVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting BigDecimal from DataObject with
+ * type long
+ */
+ public void testLongGetTypeConversionBigDecimal() {
+ DataObject product = createLongObject(5);
+ BigDecimal bdVal = product.getBigDecimal("longVal");
+ assertTrue(bdVal.intValue() == 5);
+ }
+
+ /**
+ * DataObject class test. Testing getting BigInteger from DataObject with
+ * type long
+ */
+ public void testLongGetTypeConversionBigInteger() {
+ DataObject product1 = createLongObject(5);
+ BigInteger biVal = product1.getBigInteger("longVal");
+ assertTrue(biVal.intValue() == 5);
+ }
+
+ /**
+ * DataObject class test. Testing getting date from DataObject with type
+ * long
+ */
+ public void testLongGetTypeConversionDate() {
+ Date dateNow = new Date();
+ DataObject product1 = createLongObject(dateNow.getTime());
+ Date dateRes = product1.getDate("longVal");
+ assertTrue(dateRes.getTime() == dateNow.getTime());
+ }
+
+ /**
+ * DataObject class test. Testing getting boolean from DataObject with type
+ * short
+ */
+ public void testShortGetTypeConversionBoolean() {
+ DataObject product = createShortObject((short)5);
+ try {
+ product.getBoolean("shortVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting byte from DataObject with type
+ * short
+ */
+ public void testShortGetTypeConversionByte() {
+ DataObject product1 = createShortObject((short)5);
+ byte byteVal = product1.getByte("shortVal");
+ assertTrue(byteVal == 5);
+
+ short value = (Byte.MAX_VALUE + 1);
+ DataObject product = createShortObject(value);
+ byte b = product.getByte("shortVal");
+ assertEquals((byte)value, b);
+ }
+
+ /**
+ * DataObject class test. Testing getting char from DataObject with type
+ * short
+ */
+ public void testShortGetTypeConversionChar() {
+ DataObject product = createShortObject((short)5);
+ try {
+ product.getChar("shortVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting double from DataObject with type
+ * short
+ */
+ public void testShortGetTypeConversionDouble() {
+ DataObject product = createShortObject((short)5);
+ double doubleVal = product.getDouble("shortVal");
+ assertTrue(doubleVal == 5);
+ }
+
+ /**
+ * DataObject class test. Testing getting float from DataObject with type
+ * short
+ */
+ public void testShortGetTypeConversionFloat() {
+ DataObject product = createShortObject((short)5);
+ float floatVal = product.getFloat("shortVal");
+ assertTrue(floatVal == 5);
+ }
+
+ /**
+ * DataObject class test. Testing getting int from DataObject with type
+ * short
+ */
+ public void testShortGetTypeConversionInt() {
+ DataObject product = createShortObject((short)5);
+ int intVal = product.getInt("shortVal");
+ assertTrue(intVal == 5);
+ }
+
+ /**
+ * DataObject class test. Testing getting long from DataObject with type
+ * short
+ */
+ public void testShortGetTypeConversionLong() {
+ DataObject product = createShortObject((short)5);
+ long longVal = product.getLong("shortVal");
+ assertTrue(longVal == 5);
+ }
+
+ /**
+ * DataObject class test. Testing getting bytes[] from DataObject with type
+ * short
+ */
+ public void testShortGetTypeConversionBytes() {
+ DataObject product = createShortObject((short)5);
+ try {
+ product.getBytes("shortVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing getting BigDecimal from DataObject with
+ * type short
+ */
+ public void testShortGetTypeConversionBigDecimal() {
+ short value = 5;
+ DataObject dobj = createShortObject(value);
+ assertEquals( new BigDecimal(value), dobj.getBigDecimal("shortVal") );
+ }
+
+ /**
+ * DataObject class test. Testing getting BigInteger from DataObject with
+ * type short
+ */
+ public void testShortGetTypeConversionBigInteger() {
+ short value = 5;
+ DataObject dobj = createShortObject(value);
+ assertEquals( new BigInteger(String.valueOf(value)), dobj.getBigInteger("shortVal") );
+ }
+
+ /**
+ * DataObject class test. Testing getting date from DataObject with type
+ * short
+ */
+ public void testShortGetTypeConversionDate() {
+ DataObject product = createShortObject((short)5);
+ try {
+ product.getDate("shortVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting boolean from DataObject with type
+ * byte[]
+ */
+ public void testBytesGetTypeConversionBoolean() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ try {
+ product.getBoolean("bytesVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting byte from DataObject with type
+ * byte[]
+ */
+ public void testBytesGetTypeConversionByte() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ try {
+ product.getByte("bytesVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting char from DataObject with type
+ * byte[]
+ */
+ public void testBytesGetTypeConversionChar() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ try {
+ product.getChar("bytesVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting double from DataObject with type
+ * byte[]
+ */
+ public void testBytesGetTypeConversionDouble() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ try {
+ product.getDouble("bytesVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting float from DataObject with type
+ * byte[]
+ */
+ public void testBytesGetTypeConversionFloat() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ try {
+ product.getFloat("bytesVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting int from DataObject with type
+ * byte[]
+ */
+ public void testBytesGetTypeConversionInt() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ try {
+ product.getInt("bytesVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting long from DataObject with type
+ * byte[]
+ */
+ public void testBytesGetTypeConversionLong() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ try {
+ product.getLong("bytesVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting short from DataObject with type
+ * byte[]
+ */
+ public void testBytesGetTypeConversionShort() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ try {
+ product.getShort("bytesVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting BigDecimal from DataObject with
+ * type byte[]
+ */
+ public void testBytesGetTypeConversionBigDecimal() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ try {
+ product.getBigDecimal("bytesVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting BigInteger from DataObject with
+ * type byte[]
+ */
+ public void testBytesGetTypeConversionBigInteger() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ BigInteger biVal = product.getBigInteger("bytesVal");
+ byte[] bytesRes = biVal.toByteArray();
+
+ assertEquals(2, bytesRes.length);
+ assertEquals(10, bytesRes[0]);
+ assertEquals(100, bytesRes[1]);
+ // System.out.println("testBytesGetTypeConversionBigInteger="+);
+ }
+
+ /**
+ * DataObject class test. Testing getting date from DataObject with type
+ * byte[]
+ */
+ public void testBytesGetTypeConversionDate() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ try {
+ product.getDate("bytesVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting boolean from DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalGetTypeConversionBoolean() {
+ DataObject product = createBigDecimalObject(new BigDecimal(4));
+ try {
+ product.getBoolean("bigDecimalVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting byte from DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalGetTypeConversionByte() {
+ BigDecimal value = new BigDecimal(4);
+ DataObject product = createBigDecimalObject(value);
+ assertEquals( value.byteValue(), product.getByte("bigDecimalVal") );
+ }
+
+ /**
+ * DataObject class test. Testing getting char from DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalGetTypeConversionChar() {
+ DataObject product = createBigDecimalObject(new BigDecimal(4));
+ try {
+ product.getChar("bigDecimalVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting double from DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalGetTypeConversionDouble() {
+ DataObject product = createBigDecimalObject(new BigDecimal(4));
+ double doubleVal = product.getDouble("bigDecimalVal");
+ assertTrue(doubleVal == 4);
+ }
+
+ /**
+ * DataObject class test. Testing getting float from DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalGetTypeConversionFloat() {
+ DataObject product = createBigDecimalObject(new BigDecimal(4));
+ float floatVal = product.getFloat("bigDecimalVal");
+ assertTrue(floatVal == 4);
+ }
+
+ /**
+ * DataObject class test. Testing getting int from DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalGetTypeConversionInt() {
+ DataObject product1 = createBigDecimalObject(new BigDecimal(4));
+ int intVal = product1.getInt("bigDecimalVal");
+ assertTrue(intVal == 4);
+
+ BigDecimal value = new BigDecimal(4.4);
+ DataObject product = createBigDecimalObject(value);
+ int i = product.getInt("bigDecimalVal");
+ assertEquals(value.intValue(), i);
+ }
+
+ /**
+ * DataObject class test. Testing getting long from DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalGetTypeConversionLong() {
+ DataObject product1 = createBigDecimalObject(new BigDecimal(4));
+ long intVal = product1.getLong("bigDecimalVal");
+ assertTrue(intVal == 4);
+
+ BigDecimal value = new BigDecimal(4.4);
+ DataObject product = createBigDecimalObject(value);
+ long l = product.getLong("bigDecimalVal");
+ assertEquals(value.longValue(), l);
+ }
+
+ /**
+ * DataObject class test. Testing getting short from DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalGetTypeConversionShort() {
+ BigDecimal value = new BigDecimal(4);
+ DataObject product = createBigDecimalObject(value);
+ assertEquals( value.shortValue(), product.getShort("bigDecimalVal") );
+ }
+
+ /**
+ * DataObject class test. Testing getting byte[] from DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalGetTypeConversionBytes() {
+ DataObject product = createBigDecimalObject(new BigDecimal(4));
+ try {
+ product.getBytes("bigDecimalVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting BigInteger from DataObject with
+ * type BigDecimal
+ */
+ public void testBigDecimalGetTypeConversionBigInteger() {
+ DataObject product1 = createBigDecimalObject(new BigDecimal(4));
+ BigInteger biVal = product1.getBigInteger("bigDecimalVal");
+ assertTrue(biVal.intValue() == 4);
+
+ BigDecimal value = new BigDecimal(4.4);
+ DataObject product = createBigDecimalObject(value);
+ BigInteger big = product.getBigInteger("bigDecimalVal");
+ assertEquals(value.toBigInteger(), big);
+ }
+
+ /**
+ * DataObject class test. Testing getting date from DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalGetTypeConversionDate() {
+ DataObject product = createBigDecimalObject(new BigDecimal(4));
+ try {
+ product.getDate("bigDecimalVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting boolean from DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerGetTypeConversionBoolean() {
+ DataObject product = createBigIntegerObject(BigInteger.valueOf(4));
+ try {
+ product.getBoolean("bigIntegerVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting byte from DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerGetTypeConversionByte() {
+ BigInteger value = new BigInteger("5");
+ DataObject product = createBigIntegerObject(value);
+ assertEquals( value.byteValue(), product.getByte("bigIntegerVal") );
+ }
+
+ /**
+ * DataObject class test. Testing getting char from DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerGetTypeConversionChar() {
+ DataObject product = createBigIntegerObject(BigInteger.valueOf(4));
+ try {
+ product.getChar("bigIntegerVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting double from DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerGetTypeConversionDouble() {
+ DataObject product = createBigIntegerObject(BigInteger.valueOf(4));
+ double doubleVal = product.getDouble("bigIntegerVal");
+ assertTrue(doubleVal == 4);
+ }
+
+ /**
+ * DataObject class test. Testing getting float from DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerGetTypeConversionFloat() {
+ DataObject product = createBigIntegerObject(BigInteger.valueOf(4));
+
+ float floatVal = product.getFloat("bigIntegerVal");
+ assertTrue(floatVal == 4);
+ }
+
+ /**
+ * DataObject class test. Testing getting int from DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerGetTypeConversionInt() {
+ DataObject product = createBigIntegerObject(BigInteger.valueOf(4));
+
+ int intVal = product.getInt("bigIntegerVal");
+ assertTrue(intVal == 4);
+
+ BigInteger value = BigInteger.valueOf(Long.MAX_VALUE);
+ DataObject product1 = createBigIntegerObject(value);
+ int i = product1.getInt("bigIntegerVal");
+ assertEquals(value.intValue(), i);
+ }
+
+ /**
+ * DataObject class test. Testing getting long from DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerGetTypeConversionLong() {
+ DataObject product = createBigIntegerObject(BigInteger.valueOf(4));
+
+ long longVal = product.getLong("bigIntegerVal");
+ assertTrue(longVal == 4);
+ }
+
+ /**
+ * DataObject class test. Testing getting short from DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerGetTypeConversionShort() {
+ BigInteger value = new BigInteger("5");
+ DataObject product = createBigIntegerObject(value);
+ assertEquals( value.shortValue(), product.getShort("bigIntegerVal") );
+ }
+
+ /**
+ * DataObject class test. Testing getting byte[] from DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerGetTypeConversionBytes() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBigIntegerObject(new BigInteger(byteVal));
+
+ byte[] bytesRes = product.getBytes("bigIntegerVal");
+ assertNotNull(bytesRes);
+
+ assertEquals(2, bytesRes.length);
+ assertEquals(10, bytesRes[0]);
+ assertEquals(100, bytesRes[1]);
+ }
+
+ /**
+ * DataObject class test. Testing getting BigDecimal from DataObject with
+ * type BigInteger
+ */
+ public void testBigIntegerGetTypeConversionBigDecimal() {
+ DataObject product = createBigIntegerObject(BigInteger.valueOf(4));
+
+ BigDecimal bdVal = product.getBigDecimal("bigIntegerVal");
+ assertTrue(bdVal.intValue() == 4);
+ }
+
+ /**
+ * DataObject class test. Testing getting date from DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerGetTypeConversionDate() {
+ DataObject product = createBigIntegerObject(BigInteger.valueOf(4));
+ try {
+ product.getDate("bigIntegerVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting boolean from DataObject with type
+ * date
+ */
+ public void testDateGetTypeConversionBoolean() {
+ DataObject product = createDateObject(new Date());
+ try {
+ product.getBoolean("dateVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting byte from DataObject with type
+ * date
+ */
+ public void testDateGetTypeConversionByte() {
+ DataObject product = createDateObject(new Date());
+ try {
+ product.getByte("dateVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting char from DataObject with type
+ * date
+ */
+ public void testDateGetTypeConversionChar() {
+ DataObject product = createDateObject(new Date());
+ try {
+ product.getChar("dateVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting double from DataObject with type
+ * date
+ */
+ public void testDateGetTypeConversionDouble() {
+ DataObject product = createDateObject(new Date());
+ try {
+ product.getDouble("dateVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting float from DataObject with type
+ * date
+ */
+ public void testDateGetTypeConversionFloat() {
+ DataObject product = createDateObject(new Date());
+ try {
+ product.getFloat("dateVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting int from DataObject with type date
+ */
+ public void testDateGetTypeConversionInt() {
+ DataObject product = createDateObject(new Date());
+ try {
+ product.getInt("dateVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting long from DataObject with type
+ * date
+ */
+ public void testDateGetTypeConversionLong() {
+ Date dateNow = new Date();
+ DataObject product = createDateObject(dateNow);
+
+ long longVal = product.getLong("dateVal");
+ assertEquals(dateNow.getTime(), longVal);
+
+ }
+
+ /**
+ * DataObject class test. Testing getting short from DataObject with type
+ * date
+ */
+ public void testDateGetTypeConversionShort() {
+ DataObject product = createDateObject(new Date());
+ try {
+ product.getShort("dateVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting byte[] from DataObject with type
+ * date
+ */
+ public void testDateGetTypeConversionBytes() {
+ DataObject product = createDateObject(new Date());
+ try {
+ product.getBytes("dateVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting BigDecimal from DataObject with
+ * type date
+ */
+ public void testDateGetTypeConversionBigDecimal() {
+ DataObject product = createDateObject(new Date());
+ try {
+ product.getBigDecimal("dateVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing getting BigInteger from DataObject with
+ * type date
+ */
+ public void testDateGetTypeConversionBigInteger() {
+ DataObject product = createDateObject(new Date());
+ try {
+ product.getBigInteger("dateVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting byte to DataObject with type
+ * boolean
+ */
+ public void testBooleanSetTypeConversionByte() {
+ DataObject product = createBooleanObject(true);
+ try {// to byte
+ product.setByte("boolVal", (byte)5);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting char to DataObject with type
+ * boolean
+ */
+ public void testBooleanSetTypeConversionChar() {
+ DataObject product = createBooleanObject(true);
+ try {
+ product.setChar("boolVal", 's');
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting double to DataObject with type
+ * boolean
+ */
+ public void testBooleanSetTypeConversionDouble() {
+ DataObject product = createBooleanObject(true);
+ try {
+ product.setDouble("boolVal", 5);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting float to DataObject with type
+ * boolean
+ */
+ public void testBooleanSetTypeConversionFloat() {
+ DataObject product = createBooleanObject(true);
+ try {
+ product.setFloat("boolVal", 5.5F);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting int to DataObject with type
+ * boolean
+ */
+ public void testBooleanSetTypeConversionInt() {
+ DataObject product = createBooleanObject(true);
+ try {
+ product.setInt("boolVal", 5);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting long to DataObject with type
+ * boolean
+ */
+ public void testBooleanSetTypeConversionLong() {
+ DataObject product = createBooleanObject(true);
+ try {
+ product.setLong("boolVal", 5);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting short to DataObject with type
+ * boolean
+ */
+ public void testBooleanSetTypeConversionShort() {
+ DataObject product = createBooleanObject(true);
+ try {
+ product.setShort("boolVal", (short)5);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting bytes[] to DataObject with type
+ * boolean
+ */
+ public void testBooleanSetTypeConversionBytes() {
+ DataObject product = createBooleanObject(true);
+ byte[] byteVal = {10, 100};
+ try {
+ product.setBytes("boolVal", byteVal);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting BigDecimal to DataObject with type
+ * boolean
+ */
+ public void testBooleanSetTypeConversionBigDecimal() {
+ DataObject product = createBooleanObject(true);
+ BigDecimal bdVal = new BigDecimal(4);
+ try {
+ product.setBigDecimal("boolVal", bdVal);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting BigInteger to DataObject with type
+ * boolean
+ */
+ public void testBooleanSetTypeConversionBigInteger() {
+ DataObject product = createBooleanObject(true);
+ try {
+ product.setBigInteger("boolVal", BigInteger.valueOf(4));
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting Date to DataObject with type
+ * boolean
+ */
+ public void testBooleanSetTypeConversionDate() {
+ DataObject product = createBooleanObject(true);
+ try {// to Date
+ product.setDate("boolVal", new Date());
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting boolean to DataObject with type
+ * byte
+ */
+ public void testByteSetTypeConversionBoolean() {
+ DataObject product = createByteObject((byte)5);
+ try {
+ product.setBoolean("byteVal", true);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting char to DataObject with type byte
+ */
+ public void testByteSetTypeConversionChar() {
+ DataObject product = createByteObject((byte)5);
+ try {
+ product.setChar("byteVal", 's');
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting double to DataObject with type
+ * byte
+ */
+ public void testByteSetTypeConversionDouble() {
+ DataObject product = createByteObject((byte)5);
+
+ double value = 20;
+ product.setDouble("byteVal", value);
+ byte byteVal = product.getByte("byteVal");
+ assertEquals((byte)value, byteVal);
+ }
+
+ /**
+ * DataObject class test. Testing setting float to DataObject with type byte
+ */
+ public void testByteSetTypeConversionFloat() {
+ DataObject product = createByteObject((byte)5);
+
+ float value = 6;
+ product.setFloat("byteVal", value);
+ byte byteVal = product.getByte("byteVal");
+ assertEquals((byte)value, byteVal);
+ }
+
+ /**
+ * DataObject class test. Testing setting int to DataObject with type byte
+ */
+ public void testByteSetTypeConversionInt() {
+ DataObject product = createByteObject((byte)5);
+
+ int value = Byte.MAX_VALUE + 1;
+ product.setInt("byteVal", value);
+ byte byteVal = product.getByte("byteVal");
+ assertEquals((byte)value, byteVal);
+ }
+
+ /**
+ * DataObject class test. Testing setting long to DataObject with type byte
+ */
+ public void testByteSetTypeConversionLong() {
+ DataObject product = createByteObject((byte)5);
+
+ long value = 123456789;
+ product.setLong("byteVal", value);
+ byte byteVal = product.getByte("byteVal");
+ assertEquals((byte)value, byteVal);
+
+ }
+
+ /**
+ * DataObject class test. Testing setting short to DataObject with type byte
+ */
+ public void testByteSetTypeConversionShort() {
+ DataObject product = createByteObject((byte)5);
+
+ short s = (short)6;
+ product.setShort("byteVal", s);
+ byte byteVal = product.getByte("byteVal");
+ assertEquals((byte)s, byteVal);
+ }
+
+
+ /**
+ * DataObject class test. Testing setting bytes[] to DataObject with type
+ * byte
+ */
+ public void testByteSetTypeConversionBytes() {
+ DataObject product = createByteObject((byte)5);
+ byte[] byteVal = {10, 100};
+ try {
+ product.setBytes("byteVal", byteVal);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting BigDecimal to DataObject with type
+ * byte
+ */
+ public void testByteSetTypeConversionBigDecimal() {
+ byte value = 5;
+ byte newVal = 25;
+ DataObject product = createByteObject(value);
+ product.setBigDecimal("byteVal", new BigDecimal(newVal));
+ assertEquals( newVal, product.getByte("byteVal") );
+ }
+
+ /**
+ * DataObject class test. Testing setting BigInteger to DataObject with type
+ * byte
+ */
+ public void testByteSetTypeConversionBigInteger() {
+ byte value = 5;
+ byte newVal = 25;
+ DataObject product = createByteObject(value);
+ product.setBigInteger("byteVal", BigInteger.valueOf(newVal));
+ assertEquals( newVal, product.getByte("byteVal") );
+ }
+
+ /**
+ * DataObject class test. Testing setting Date to DataObject with type byte
+ */
+ public void testByteSetTypeConversionDate() {
+ DataObject product = createByteObject((byte)5);
+ try {
+ product.setDate("byteVal", new Date());
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting boolean to DataObject with type
+ * char
+ */
+ public void testCharSetTypeConversionBoolean() {
+ DataObject product = createCharObject('s');
+ try {
+ product.setBoolean("charVal", true);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting byte to DataObject with type char
+ */
+ public void testCharSetTypeConversionByte() {
+ DataObject product = createCharObject('s');
+ try {
+ product.setByte("charVal", (byte)5);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting double to DataObject with type
+ * char
+ */
+ public void testCharSetTypeConversionDouble() {
+ DataObject product = createCharObject('s');
+ try {
+ product.setDouble("charVal", (double)5);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting float to DataObject with type char
+ */
+ public void testCharSetTypeConversionFloat() {
+ DataObject product = createCharObject('s');
+ try {
+ product.setFloat("charVal", 5.5F);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting int to DataObject with type char
+ */
+ public void testCharSetTypeConversionInt() {
+ DataObject product = createCharObject('s');
+ try {
+ product.setInt("charVal", 5);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting long to DataObject with type char
+ */
+ public void testCharSetTypeConversionLong() {
+ DataObject product = createCharObject('s');
+ try {
+ product.setLong("charVal", (long)5);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting short to DataObject with type char
+ */
+ public void testCharSetTypeConversionShort() {
+ DataObject product = createCharObject('s');
+ try {
+ product.setShort("charVal", (short)5);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting bytes[] to DataObject with type
+ * char
+ */
+ public void testCharSetTypeConversionBytes() {
+ DataObject product = createCharObject('s');
+ byte[] byteVal = {10, 100};
+ try {
+ product.setBytes("charVal", byteVal);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting BigDecimal to DataObject with type
+ * char
+ */
+ public void testCharSetTypeConversionBigDecimal() {
+ DataObject product = createCharObject('s');
+ try {
+ product.setBigDecimal("charVal", new BigDecimal(4));
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting BigInteger to DataObject with type
+ * char
+ */
+ public void testCharSetTypeConversionBigInteger() {
+ DataObject product = createCharObject('s');
+ try {
+ product.setBigInteger("charVal", BigInteger.valueOf(5));
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting Date to DataObject with type char
+ */
+ public void testCharSetTypeConversionDate() {
+ DataObject product = createCharObject('s');
+ try {
+ product.setDate("charVal", new Date());
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting boolean to DataObject with type
+ * double
+ */
+ public void testDoubleSetTypeConversionBoolean() {
+ DataObject product = createDoubleObject(5);
+ try {
+ product.setBoolean("doubleVal", true);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting byte to DataObject with type
+ * double
+ */
+ public void testDoubleSetTypeConversionByte() {
+ DataObject product1 = createDoubleObject(5);
+ product1.setByte("doubleVal", (byte)6);
+ double doubleVal = product1.getDouble("doubleVal");
+ assertTrue(doubleVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting char to DataObject with type
+ * double
+ */
+ public void testDoubleSetTypeConversionChar() {
+ DataObject product = createDoubleObject(5);
+ try {
+ product.setChar("doubleVal", 's');
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting float to DataObject with type
+ * double
+ */
+ public void testDoubleSetTypeConversionFloat() {
+ DataObject product1 = createDoubleObject(5);
+ product1.setFloat("doubleVal", 6);
+ double doubleVal = product1.getDouble("doubleVal");
+ assertTrue(doubleVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting int to DataObject with type double
+ */
+ public void testDoubleSetTypeConversionInt() {
+ DataObject product1 = createDoubleObject(5);
+ product1.setInt("doubleVal", 6);
+ double doubleVal = product1.getDouble("doubleVal");
+ assertTrue(doubleVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting long to DataObject with type
+ * double
+ */
+ public void testDoubleSetTypeConversionLong() {
+ DataObject product1 = createDoubleObject(5);
+ product1.setLong("doubleVal", (long)6);
+ double doubleVal = product1.getDouble("doubleVal");
+ assertTrue(doubleVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting short to DataObject with type
+ * double
+ */
+ public void testDoubleSetTypeConversionShort() {
+ DataObject product1 = createDoubleObject(5);
+ product1.setShort("doubleVal", (short)6);
+ double doubleVal = product1.getDouble("doubleVal");
+ assertTrue(doubleVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting byte[] to DataObject with type
+ * double
+ */
+ public void testDoubleSetTypeConversionBytes() {
+ DataObject product = createDoubleObject(5);
+ byte[] byteVal = {10, 100};
+ try {
+ product.setBytes("doubleVal", byteVal);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting Bigdecimal to DataObject with type
+ * double
+ */
+ public void testDoubleSetTypeConversionBigDecimal() {
+ DataObject product = createDoubleObject(5);
+
+ product.setBigDecimal("doubleVal", new BigDecimal(6));
+ double doubleVal = product.getDouble("doubleVal");
+ assertTrue(doubleVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting BigInteger to DataObject with type
+ * double
+ */
+ public void testDoubleSetTypeConversionBigInteger() {
+ DataObject product = createDoubleObject(5);
+
+ product.setBigInteger("doubleVal", BigInteger.valueOf(6));
+ double doubleVal = product.getDouble("doubleVal");
+ assertTrue(doubleVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting date to DataObject with type
+ * double
+ */
+ public void testDoubleSetTypeConversionDate() {
+ DataObject product = createDoubleObject(5);
+ try {
+ product.getDate("doubleVal");
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting boolean to DataObject with type
+ * float
+ */
+ public void testFloatSetTypeConversionBoolean() {
+ DataObject product = createFloatObject(5);
+ try {
+ product.setBoolean("floatVal", true);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting byte to DataObject with type float
+ */
+ public void testFloatSetTypeConversionByte() {
+ DataObject product1 = createFloatObject(5);
+ product1.setByte("floatVal", (byte)6);
+
+ float floatVal = product1.getFloat("floatVal");
+ assertTrue(floatVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting char to DataObject with type float
+ */
+ public void testFloatSetTypeConversionChar() {
+ DataObject product = createFloatObject(5);
+ try {
+ product.setChar("floatVal", 's');
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting double to DataObject with type
+ * float
+ */
+ public void testFloatSetTypeConversionDouble() {
+ DataObject product1 = createFloatObject(5);
+ product1.setDouble("floatVal", (double)6);
+ float floatVal = product1.getFloat("floatVal");
+ assertTrue(floatVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting int to DataObject with type float
+ */
+ public void testFloatSetTypeConversionInt() {
+ DataObject product1 = createFloatObject(5);
+ int value = 6;
+ product1.setInt("floatVal", value);
+ float floatVal = product1.getFloat("floatVal");
+ assertEquals((float)value, floatVal);
+ }
+
+ /**
+ * DataObject class test. Testing setting long to DataObject with type float
+ */
+ public void testFloatSetTypeConversionLong() {
+ DataObject product1 = createFloatObject(5);
+ product1.setLong("floatVal", (long)6);
+
+ float floatVal = product1.getFloat("floatVal");
+ assertTrue(floatVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting short to DataObject with type
+ * float
+ */
+ public void testFloatSetTypeConversionShort() {
+ DataObject product1 = createFloatObject(5);
+ product1.setShort("floatVal", (short)6);
+ float floatVal = product1.getFloat("floatVal");
+ assertTrue(floatVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting byte[] to DataObject with type
+ * float
+ */
+ public void testFloatSetTypeConversionBytes() {
+ DataObject product = createFloatObject(5);
+
+ byte[] byteVal = {10, 100};
+ try {
+ product.setBytes("floatVal", byteVal);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting BigDecimal to DataObject with type
+ * float
+ */
+ public void testFloatSetTypeConversionBigDecimal() {
+ DataObject product = createFloatObject(5.5F);
+ product.setBigDecimal("floatVal", new BigDecimal(6));
+ float floatVal = product.getFloat("floatVal");
+ assertTrue(floatVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing Setting BigInteger to DataObject with type
+ * float
+ */
+ public void testFloatSetTypeConversionBigInteger() {
+ DataObject product1 = createFloatObject(5);
+ product1.setBigInteger("floatVal", BigInteger.valueOf(6));
+
+ float floatVal = product1.getFloat("floatVal");
+ assertTrue(floatVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting date to DataObject with type float
+ */
+ public void testFloatSetTypeConversionDate() {
+ DataObject product = createFloatObject(5);
+ try {
+ product.setDate("floatVal", new Date());
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting boolean to DataObject with type
+ * int
+ */
+ public void testIntSetTypeConversionBoolean() {
+ DataObject product = createIntObject(5);
+ try {
+ product.setBoolean("intVal", true);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting byte to DataObject with type int
+ */
+ public void testIntSetTypeConversionByte() {
+ DataObject product1 = createIntObject(5);
+ product1.setByte("intVal", (byte)6);
+
+ int intVal = product1.getInt("intVal");
+ assertTrue(intVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting char to DataObject with type int
+ */
+ public void testIntSetTypeConversionChar() {
+ DataObject product = createIntObject(5);
+ try {
+ product.setChar("intVal", 's');
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting double to DataObject with type int
+ */
+ public void testIntSetTypeConversionDouble() {
+ DataObject product = createIntObject(5);
+ double value = (double)6;
+ product.setDouble("intVal", value);
+ int intVal = product.getInt("intVal");
+ assertEquals((int)value, intVal);
+ }
+
+ /**
+ * DataObject class test. Testing setting float to DataObject with type int
+ */
+ public void testIntSetTypeConversionFloat() {
+ DataObject product1 = createIntObject(5);
+ float value = 6.0F;
+ product1.setFloat("intVal", value);
+ int intVal = product1.getInt("intVal");
+ assertEquals((int)value, intVal);
+ }
+
+ /**
+ * DataObject class test. Testing setting long to DataObject with type int
+ */
+ public void testIntSetTypeConversionLong() {
+ DataObject product = createIntObject(5);
+ long value = (long)6789;
+ product.setLong("intVal", value);
+ int intVal = product.getInt("intVal");
+ assertEquals((int)value, intVal);
+ }
+
+ /**
+ * DataObject class test. Testing setting short to DataObject with type int
+ */
+ public void testIntSetTypeConversionShort() {
+ DataObject product1 = createIntObject(5);
+ product1.setShort("intVal", (short)6);
+
+ int intVal = product1.getInt("intVal");
+ assertTrue(intVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting bytes[] to DataObject with type
+ * int
+ */
+ public void testIntSetTypeConversionBytes() {
+ DataObject product = createIntObject(5);
+ byte[] byteVal = {10, 100};
+ try {
+ product.setBytes("intVal", byteVal);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting BigDecimal to DataObject with type
+ * int
+ */
+ public void testIntSetTypeConversionBigDecimal() {
+ DataObject product1 = createIntObject(5);
+ product1.setBigDecimal("intVal", new BigDecimal(6));
+
+ int intVal = product1.getInt("intVal");
+ assertTrue(intVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting BigInteger to DataObject with type
+ * int
+ */
+ public void testIntSetTypeConversionBigInteger() {
+ DataObject product = createIntObject(5);
+ product.setBigInteger("intVal", BigInteger.valueOf(6));
+
+ int intVal = product.getInt("intVal");
+ assertTrue(intVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting date to DataObject with type int
+ */
+ public void testIntSetTypeConversionDate() {
+ DataObject product = createIntObject(5);
+ try {
+ product.setDate("intVal", new Date());
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting boolean to DataObject with type
+ * long
+ */
+ public void testLongSetTypeConversionBoolean() {
+ DataObject product = createLongObject(5);
+ try {
+ product.setBoolean("longVal", true);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting byte to DataObject with type long
+ */
+ public void testLongSetTypeConversionByte() {
+ DataObject product1 = createLongObject(5);
+ product1.setByte("longVal", (byte)6);
+ long longVal = product1.getLong("longVal");
+ assertTrue(longVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting char to DataObject with type long
+ */
+ public void testLongSetTypeConversionChar() {
+ DataObject product = createLongObject(5);
+ try {
+ product.setChar("longVal", 's');
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting double to DataObject with type
+ * long
+ */
+ public void testLongSetTypeConversionDouble() {
+ DataObject product = createLongObject(5);
+ product.setDouble("longVal", (double)6);
+ long longVal = product.getLong("longVal");
+ assertTrue(longVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting float to DataObject with type long
+ */
+ public void testLongSetTypeConversionFloat() {
+ DataObject product1 = createLongObject(5);
+ float value = 6F;
+ product1.setFloat("longVal", value);
+ long longVal = product1.getLong("longVal");
+ assertEquals((long)value, longVal);
+ }
+
+ /**
+ * DataObject class test. Testing setting int to DataObject with type long
+ */
+ public void testLongSetTypeConversionInt() {
+ DataObject product1 = createLongObject(5);
+ product1.setInt("longVal", 6);
+ long longVal = product1.getLong("longVal");
+ assertTrue(longVal == 6);
+
+ }
+
+ /**
+ * DataObject class test. Testing setting short to DataObject with type long
+ */
+ public void testLongSetTypeConversionShort() {
+ DataObject product1 = createLongObject(5);
+ product1.setShort("longVal", (short)6);
+ long longVal = product1.getLong("longVal");
+ assertTrue(longVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting byte[] to DataObject with type
+ * long
+ */
+ public void testLongSetTypeConversionBytes() {
+ DataObject product = createLongObject(5);
+
+ byte[] byteVal = {10, 100};
+ try {
+ product.setBytes("longVal", byteVal);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting BigDecimal to DataObject with type
+ * long
+ */
+ public void testLongSetTypeConversionBigDecimal() {
+ DataObject product = createLongObject(5);
+ product.setBigDecimal("longVal", new BigDecimal(6));
+ long longVal = product.getLong("longVal");
+ assertTrue(longVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting BigInteger to DataObject with type
+ * long
+ */
+ public void testLongSetTypeConversionBigInteger() {
+ DataObject product1 = createLongObject(5);
+ product1.setBigInteger("longVal", BigInteger.valueOf(6));
+ long longVal = product1.getLong("longVal");
+ assertTrue(longVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting date to DataObject with type long
+ */
+ public void testLongSetTypeConversionDate() {
+ Date dateNow = new Date();
+ DataObject product1 = createLongObject(5);
+ product1.setDate("longVal", dateNow);
+
+ long longVal = product1.getLong("longVal");
+ assertTrue(longVal == dateNow.getTime());
+ }
+
+ /**
+ * DataObject class test. Testing setting boolean to DataObject with type
+ * short
+ */
+ public void testShortSetTypeConversionBoolean() {
+ DataObject product = createShortObject((short)5);
+ try {
+ product.setBoolean("shortVal", true);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting byte to DataObject with type short
+ */
+ public void testShortSetTypeConversionByte() {
+ DataObject product1 = createShortObject((short)5);
+ product1.setByte("shortVal", (byte)6);
+ short shortVal = product1.getShort("shortVal");
+ assertTrue(shortVal == 6);
+ }
+
+ /**
+ * DataObject class test. Testing setting char to DataObject with type short
+ */
+ public void testShortSetTypeConversionChar() {
+ DataObject product = createShortObject((short)5);
+ try {
+ product.setChar("shortVal", 's');
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting double to DataObject with type
+ * short
+ */
+ public void testShortSetTypeConversionDouble() {
+ DataObject product = createShortObject((short)5);
+ double value = (double)6;
+ product.setDouble("shortVal", value);
+ short shortVal = product.getShort("shortVal");
+ assertEquals((short)value, shortVal);
+ }
+
+ /**
+ * DataObject class test. Testing getting float from DataObject with type
+ * short
+ */
+ public void testShortSetTypeConversionFloat() {
+ DataObject product = createShortObject((short)5);
+ float value = 6F;
+ product.setFloat("shortVal", value);
+ short shortVal = product.getShort("shortVal");
+ assertEquals((short)value, shortVal);
+ }
+
+ /**
+ * DataObject class test. Testing setting int to DataObject with type short
+ */
+ public void testShortSetTypeConversionInt() {
+ DataObject product = createShortObject((short)5);
+ int value = 123456;
+ product.setInt("shortVal", value);
+ short shortVal = product.getShort("shortVal");
+ assertEquals((short)value, shortVal);
+ }
+
+ /**
+ * DataObject class test. Testing setting long to DataObject with type short
+ */
+ public void testShortSetTypeConversionLong() {
+ DataObject product = createShortObject((short)5);
+ long value = (long)6;
+ product.setLong("shortVal", value);
+ short shortVal = product.getShort("shortVal");
+ assertEquals((short)value, shortVal);
+ }
+
+
+ /**
+ * DataObject class test. Testing setting bytes[] to DataObject with type
+ * short
+ */
+ public void testShortSetTypeConversionBytes() {
+ DataObject product = createShortObject((short)5);
+ byte[] byteVal = {10, 100};
+ try {
+ product.setBytes("shortVal", byteVal);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * DataObject class test. Testing setting BigDecimal to DataObject with type
+ * short
+ */
+ public void testShortSetTypeConversionBigDecimal() {
+ short value = 5;
+ BigDecimal newValue = new BigDecimal(6);
+ DataObject product = createShortObject(value);
+ product.setBigDecimal("shortVal", newValue);
+ assertEquals( newValue, product.getBigDecimal("shortVal") );
+ }
+
+ /**
+ * DataObject class test. Testing setting BigInteger to DataObject with type
+ * short
+ */
+ public void testShortSetTypeConversionBigInteger() {
+ short value = 5;
+ BigInteger newValue = BigInteger.valueOf(6);
+ DataObject product = createShortObject(value);
+ product.setBigInteger("shortVal", newValue);
+ assertEquals( newValue, product.getBigInteger("shortVal") );
+ }
+
+ /**
+ * DataObject class test. Testing setting date to DataObject with type short
+ */
+ public void testShortSetTypeConversionDate() {
+ DataObject product = createShortObject((short)5);
+ try {
+ product.setDate("shortVal", new Date());
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+
+ /**
+ * DataObject class test. Testing setting boolean to DataObject with type
+ * byte[]
+ */
+ public void testBytesSetTypeConversionBoolean() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ try {
+ product.setBoolean("bytesVal", true);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting byte to DataObject with type
+ * byte[]
+ */
+ public void testBytesSetTypeConversionByte() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ try {
+ product.setByte("bytesVal", (byte)5);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting char to DataObject with type
+ * byte[]
+ */
+ public void testBytesSetTypeConversionChar() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ try {
+ product.setChar("bytesVal", 's');
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting double to DataObject with type
+ * byte[]
+ */
+ public void testBytesSetTypeConversionDouble() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ try {
+ product.setDouble("bytesVal", 5);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting float to DataObject with type
+ * byte[]
+ */
+ public void testBytesSetTypeConversionFloat() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ try {
+ product.setFloat("bytesVal", 5.5F);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting int to DataObject with type byte[]
+ */
+ public void testBytesSetTypeConversionInt() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ try {
+ product.setInt("bytesVal", 5);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting long to DataObject with type
+ * byte[]
+ */
+ public void testBytesSetTypeConversionLong() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ try {
+ product.setLong("bytesVal", (long)5);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting short to DataObject with type
+ * byte[]
+ */
+ public void testBytesSetTypeConversionShort() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ try {
+ product.setShort("bytesVal", (short)5);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting BigDecimal to DataObject with type
+ * byte[]
+ */
+ public void testBytesSetTypeConversionBigDecimal() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ try {
+ product.setBigDecimal("bytesVal", new BigDecimal(4));
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting BigInteger to DataObject with type
+ * byte[]
+ */
+ public void testBytesSetTypeConversionBigInteger() {
+ byte[] byteArray1 = {1, 2};
+ byte[] byteArray2 = {10, 100};
+
+ DataObject product = createBytesObject(byteArray1);
+
+ BigInteger value = new BigInteger(byteArray2);
+ product.setBigInteger("bytesVal", value);
+
+ byte[] bytesRes = product.getBytes("bytesVal");
+ assertNotNull(bytesRes);
+
+ assertEquals(2, bytesRes.length);
+ assertEquals(10, bytesRes[0]);
+ assertEquals(100, bytesRes[1]);
+ }
+
+ /**
+ * DataObject class test. Testing setting date to DataObject with type
+ * byte[]
+ */
+ public void testBytesSetTypeConversionDate() {
+ byte[] byteVal = {10, 100};
+ DataObject product = createBytesObject(byteVal);
+ try {
+ product.setDate("bytesVal", new Date());
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting boolean to DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalSetTypeConversionBoolean() {
+ DataObject product = createBigDecimalObject(new BigDecimal(4));
+ try {
+ product.setBoolean("bigDecimalVal", true);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting byte to DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalSetTypeConversionByte() {
+ byte byteValue = 12;
+ BigDecimal value = BigDecimal.valueOf(4);
+ DataObject product = createBigDecimalObject(value);
+ product.setByte("bigDecimalVal", byteValue );
+ assertEquals( byteValue, product.getByte("bigDecimalVal") );
+ }
+
+ /**
+ * DataObject class test. Testing setting char to DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalSetTypeConversionChar() {
+ DataObject product = createBigDecimalObject(new BigDecimal(4));
+ try {
+ product.setChar("bigDecimalVal", 's');
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting double to DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalSetTypeConversionDouble() {
+ DataObject product = createBigDecimalObject(new BigDecimal(4));
+ product.setDouble("bigDecimalVal", 5);
+ BigDecimal bdVal = product.getBigDecimal("bigDecimalVal");
+ assertTrue(bdVal.intValue() == 5);
+ }
+
+ /**
+ * DataObject class test. Testing setting float to DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalSetTypeConversionFloat() {
+ DataObject product = createBigDecimalObject(new BigDecimal(4));
+ product.setFloat("bigDecimalVal", 5F);
+ BigDecimal bdVal = product.getBigDecimal("bigDecimalVal");
+ assertTrue(bdVal.intValue() == 5);
+ }
+
+ /**
+ * DataObject class test. Testing setting int to DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalSetTypeConversionInt() {
+ DataObject product = createBigDecimalObject(new BigDecimal(4));
+ product.setInt("bigDecimalVal", 5);
+ BigDecimal bdVal = product.getBigDecimal("bigDecimalVal");
+ assertTrue(bdVal.intValue() == 5);
+ }
+
+ /**
+ * DataObject class test. Testing setting long to DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalSetTypeConversionLong() {
+ DataObject product = createBigDecimalObject(new BigDecimal(4));
+ product.setLong("bigDecimalVal", (long)5);
+
+ BigDecimal bdVal = product.getBigDecimal("bigDecimalVal");
+ assertTrue(bdVal.intValue() == 5);
+ }
+
+ /**
+ * DataObject class test. Testing setting short to DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalSetTypeConversionShort() {
+ BigDecimal value = new BigDecimal(4);
+ short newValue = (short) 5;
+ DataObject product = createBigDecimalObject(value);
+ product.setShort("bigDecimalVal", newValue);
+ assertEquals( newValue, product.getShort("bigDecimalVal") );
+ }
+
+ /**
+ * DataObject class test. Testing setting byte[] to DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalSetTypeConversionBytes() {
+ DataObject product = createBigDecimalObject(new BigDecimal(4));
+
+ byte[] byteVal = {10, 100};
+ try {
+ product.setBytes("bigDecimalVal", byteVal);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting BigInteger to DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalSetTypeConversionBigInteger() {
+ DataObject product = createBigDecimalObject(new BigDecimal(4));
+ product.setBigInteger("bigDecimalVal", BigInteger.valueOf(5));
+
+ BigDecimal bdVal = product.getBigDecimal("bigDecimalVal");
+ assertTrue(bdVal.intValue() == 5);
+ }
+
+ /**
+ * DataObject class test. Testing setting date to DataObject with type
+ * BigDecimal
+ */
+ public void testBigDecimalSetTypeConversionDate() {
+ DataObject product = createBigDecimalObject(new BigDecimal(4));
+ try {
+ product.setDate("bigDecimalVal", new Date());
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting boolean to DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerSetTypeConversionBoolean() {
+ DataObject product = createBigIntegerObject(BigInteger.valueOf(4));
+ try {
+ product.setBoolean("bigIntegerVal", true);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting byte to DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerSetTypeConversionByte() {
+ byte byteValue = 12;
+ BigInteger value = BigInteger.valueOf(4);
+ DataObject product = createBigIntegerObject(value);
+ product.setByte("bigIntegerVal", byteValue );
+ assertEquals( byteValue, product.getByte("bigIntegerVal") );
+ }
+
+ /**
+ * DataObject class test. Testing setting char to DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerSetTypeConversionChar() {
+ DataObject product = createBigIntegerObject(BigInteger.valueOf(4));
+ try {
+ product.setChar("bigIntegerVal", 's');
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting double to DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerSetTypeConversionDouble() {
+ DataObject product = createBigIntegerObject(BigInteger.valueOf(4));
+ product.setDouble("bigIntegerVal", 5);
+ BigInteger biVal = product.getBigInteger("bigIntegerVal");
+ assertTrue(biVal.intValue() == 5);
+ }
+
+ /**
+ * DataObject class test. Testing setting float to DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerSetTypeConversionFloat() {
+ DataObject product = createBigIntegerObject(BigInteger.valueOf(4));
+
+ product.setFloat("bigIntegerVal", 5F);
+ BigInteger biVal = product.getBigInteger("bigIntegerVal");
+ assertTrue(biVal.intValue() == 5);
+ }
+
+ /**
+ * DataObject class test. Testing setting int to DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerSetTypeConversionInt() {
+ DataObject product = createBigIntegerObject(BigInteger.valueOf(4));
+
+ product.setInt("bigIntegerVal", 5);
+ BigInteger biVal = product.getBigInteger("bigIntegerVal");
+ assertTrue(biVal.intValue() == 5);
+ }
+
+ /**
+ * DataObject class test. Testing setting long to DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerSetTypeConversionLong() {
+ DataObject product = createBigIntegerObject(BigInteger.valueOf(4));
+
+ product.setLong("bigIntegerVal", 5);
+ BigInteger biVal = product.getBigInteger("bigIntegerVal");
+ assertTrue(biVal.intValue() == 5);
+ }
+
+ /**
+ * DataObject class test. Testing setting short to DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerSetTypeConversionShort() {
+ BigInteger value = BigInteger.valueOf(4);
+ short newValue = (short) 5;
+ DataObject product = createBigIntegerObject(value);
+ product.setShort("bigIntegerVal", newValue);
+ assertEquals( newValue, product.getShort("bigIntegerVal") );
+ }
+
+ /**
+ * DataObject class test. Testing setting byte[] to DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerSetTypeConversionBytes() {
+ DataObject product = createBigIntegerObject(BigInteger.valueOf(4));
+
+ byte[] byteVal = {10, 100};
+ product.setBytes("bigIntegerVal", byteVal);
+
+ BigInteger biVal = product.getBigInteger("bigIntegerVal");
+
+ byte[] bytesRes = biVal.toByteArray();
+ assertNotNull(bytesRes);
+
+ assertEquals(2, bytesRes.length);
+ assertEquals(10, bytesRes[0]);
+ assertEquals(100, bytesRes[1]);
+ }
+
+ /**
+ * DataObject class test. Testing setting BigDecimal to DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerSetTypeConversionBigDecimal() {
+ DataObject product = createBigIntegerObject(BigInteger.valueOf(4));
+
+ product.setBigDecimal("bigIntegerVal", new BigDecimal(5));
+ BigInteger biVal = product.getBigInteger("bigIntegerVal");
+ assertTrue(biVal.intValue() == 5);
+ }
+
+ /**
+ * DataObject class test. Testing setting date to DataObject with type
+ * BigInteger
+ */
+ public void testBigIntegerSetTypeConversionDate() {
+ DataObject product = createBigIntegerObject(BigInteger.valueOf(4));
+ try {
+ product.setDate("bigIntegerVal", new Date());
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting boolean to DataObject with type
+ * date
+ */
+ public void testDateSetTypeConversionBoolean() {
+ DataObject product = createDateObject(new Date());
+ try {
+ product.setBoolean("dateVal", true);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting byte to DataObject with type date
+ */
+ public void testDateSetTypeConversionByte() {
+ DataObject product = createDateObject(new Date());
+ try {
+ product.setByte("dateVal", (byte)5);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting char to DataObject with type date
+ */
+ public void testDateSetTypeConversionChar() {
+ DataObject product = createDateObject(new Date());
+ try {
+ product.setChar("dateVal", 's');
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting double to DataObject with type
+ * date
+ */
+ public void testDateSetTypeConversionDouble() {
+ DataObject product = createDateObject(new Date());
+ try {
+ product.setDouble("dateVal", 5);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting float to DataObject with type date
+ */
+ public void testDateSetTypeConversionFloat() {
+ DataObject product = createDateObject(new Date());
+ try {
+ product.setFloat("dateVal", 5F);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting int to DataObject with type date
+ */
+ public void testDateSetTypeConversionInt() {
+ DataObject product = createDateObject(new Date());
+ try {
+ product.setInt("dateVal", 5);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting long to DataObject with type date
+ */
+ public void testDateSetTypeConversionLong() {
+ Date dateNow = new Date();
+ DataObject product = createDateObject(dateNow);
+
+ product.setLong("dateVal", dateNow.getTime());
+ Date dateRes = product.getDate("dateVal");
+ assertEquals(dateNow.getTime(), dateRes.getTime());
+ }
+
+ /**
+ * DataObject class test. Testing setting short to DataObject with type date
+ */
+ public void testDateSetTypeConversionShort() {
+ DataObject product = createDateObject(new Date());
+ try {
+ product.setShort("dateVal", (short)5);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting byte[] to DataObject with type
+ * date
+ */
+ public void testDateSetTypeConversionBytes() {
+ DataObject product = createDateObject(new Date());
+
+ byte[] byteVal = {10, 100};
+ try {
+ product.setBytes("dateVal", byteVal);
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting BigDecimal to DataObject with type
+ * date
+ */
+ public void testDateSetTypeConversionBigDecimal() {
+ DataObject product = createDateObject(new Date());
+ try {
+ product.setBigDecimal("dateVal", new BigDecimal(5));
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+
+ /**
+ * DataObject class test. Testing setting BigInteger to DataObject with type
+ * date
+ */
+ public void testDateSetTypeConversionBigInteger() {
+ DataObject product = createDateObject(new Date());
+ try {
+ product.setBigInteger("dateVal", BigInteger.valueOf(5));
+ fail(EXPECTED_CLASS_CAST_EXCEPTION);
+ } catch (ClassCastException e) {
+ // expected
+ }
+ }
+}