You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ke...@apache.org on 2007/07/13 17:38:26 UTC
svn commit: r556038 [3/4] - in /incubator/tuscany/java/sdo/impl/src:
main/java/org/apache/tuscany/sdo/helper/
main/java/org/apache/tuscany/sdo/impl/ main/java/org/apache/tuscany/sdo/util/
test/java/com/example/ExpectedException/ test/java/com/example/E...
Added: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ExpectedExceptionsTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ExpectedExceptionsTestCase.java?view=auto&rev=556038
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ExpectedExceptionsTestCase.java (added)
+++ incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ExpectedExceptionsTestCase.java Fri Jul 13 08:38:22 2007
@@ -0,0 +1,1878 @@
+/**
+ *
+ * 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 org.apache.tuscany.sdo.test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import com.example.ExpectedException.ExpectedExceptionFactory;
+
+import commonj.sdo.DataGraph;
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Sequence;
+import commonj.sdo.Type;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.TypeHelper;
+
+import junit.framework.TestCase;
+
+/**
+ * Verifies the Exception related behavior which is explicitly identified in
+ * the 2.1 SDO Specification.
+ */
+public class ExpectedExceptionsTestCase extends TestCase {
+
+ private static final String TEST_URI = "http://example.com/ExpectedException";
+ private static final String TEST_TYPE_NAME = "ExpectedExceptionType";
+ private static final String SEQ_TYPE_NAME = "SequenceReadOnlyType";
+ private static boolean typeDefined = false;
+ private static HelperContext helperContext;
+ private static DataObject testDO;
+ private static DataObject seqDO;
+
+ /**
+ * Verifies the following statement.
+ * Get<T>(String path) will not throw exceptions other than ClassCastException
+ * if it is impossible to convert between the actual and expected types.
+ * Note: This test case will not be implmented because it is already covered
+ * by testCannnotConvertClassCastException.
+ */
+
+ public void testGetTStringClassCastExceptionOnly() {
+ // This test case will not be implemented.
+ }
+
+ /**
+ * Verifies the following statement.
+ * get<T>(Property property) throws an IllegalArgumentException when
+ * getInstanceProperties().contains(property) == false.
+ */
+ public void testGetViaPropertyIllegalArgumentException() {
+ DataObject invalidPropDO = helperContext.getDataFactory().create(TEST_URI, SEQ_TYPE_NAME);
+ Property invalidProp = invalidPropDO.getInstanceProperty("uniqueName");
+
+ try {
+ testDO.get(invalidProp);
+ fail("get(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("get(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getBoolean(invalidProp);
+ fail("getBoolean(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBoolean(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getByte(invalidProp);
+ fail("getByte(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getByte(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getChar(invalidProp);
+ fail("getChar(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getChar(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getDouble(invalidProp);
+ fail("getDouble(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getDouble(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getFloat(invalidProp);
+ fail("getFloat(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getFloat(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getInt(invalidProp);
+ fail("getInt(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getInt(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getLong(invalidProp);
+ fail("getLong(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getLong(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getShort(invalidProp);
+ fail("getShort(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getShort(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getBytes(invalidProp);
+ fail("getBytes(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBytes(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getBigDecimal(invalidProp);
+ fail("getBigDecimal(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBigDecimal(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getBigInteger(invalidProp);
+ fail("getBigInteger(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBigInteger(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getDataObject(invalidProp);
+ fail("getDataObject(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getDataObject(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getDate(invalidProp);
+ fail("getDate(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getDate(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getString(invalidProp);
+ fail("getString(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getString(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getList(invalidProp);
+ fail("getList(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(propert)== false. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getList(Property property) should throw an IllegalArgumentException when getInstanceProperties().contains(property)== false. " + e.getClass().getName() + " was thrown.");
+ }
+ }
+
+ /**
+ * Verfies the following statement.
+ * get<T>(int propertyIndex) throws an IllegalArgumentException when
+ * propertIndex <0 or >= getInstanceProerties().size()
+ */
+ public void testGetViaIndexIllegalArgumentException() {
+ int numProps = testDO.getInstanceProperties().size();
+
+ try {
+ testDO.get(-1);
+ fail("get(-1) should throw an IllegalArgumentException. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("get(-1) should throw an IllegalArgumentException. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getBoolean(-1);
+ fail("getBoolean(-1) should throw an IllegalArgumentException. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBoolean(-1) should throw an IllegalArgumentException. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getByte(-1);
+ fail("getByte(-1) should throw an IllegalArgumentException. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getByte(-1) should throw an IllegalArgumentException. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getChar(-1);
+ fail("getChar(-1) should throw an IllegalArgumentException. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getChar(-1) should throw an IllegalArgumentException. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getDouble(-1);
+ fail("getDouble(-1) should throw an IllegalArgumentException. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getDouble(-1) should throw an IllegalArgumentException. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getFloat(-1);
+ fail("getFloat(-1) should throw an IllegalArgumentException. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getFloat(-1) should throw an IllegalArgumentException. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getInt(-1);
+ fail("getInt(-1) should throw an IllegalArgumentException. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getInt(-1) should throw an IllegalArgumentException. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getLong(-1);
+ fail("getLong(-1) should throw an IllegalArgumentException. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getLong(-1) should throw an IllegalArgumentException. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getShort(-1);
+ fail("getShort(-1) should throw an IllegalArgumentException. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getShort(-1) should throw an IllegalArgumentException. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getBytes(-1);
+ fail("getBytes(-1) should throw an IllegalArgumentException. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBytes(-1) should throw an IllegalArgumentException. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getBigDecimal(-1);
+ fail("getBigDecimal(-1) should throw an IllegalArgumentException. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBigDecimal(-1) should throw an IllegalArgumentException. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getBigInteger(-1);
+ fail("getBigInteger(-1) should throw an IllegalArgumentException. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBigInteger(-1) should throw an IllegalArgumentException. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getDataObject(-1);
+ fail("getDataObject(-1) should throw an IllegalArgumentException. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getDataObject(-1) should throw an IllegalArgumentException. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getDate(-1);
+ fail("getDate(-1) should throw an IllegalArgumentException. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getDate(-1) should throw an IllegalArgumentException. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getString(-1);
+ fail("getString(-1) should throw an IllegalArgumentException. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getString(-1) should throw an IllegalArgumentException. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getList(-1);
+ fail("getList(-1) should throw an IllegalArgumentException. No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getList(-1) should throw an IllegalArgumentException. " + e.getClass().getName() + " was thrown.");
+ }
+
+ try {
+ testDO.get(numProps);
+ fail("get(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("get(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getBoolean(numProps);
+ fail("getBoolean(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBoolean(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getByte(numProps);
+ fail("getByte(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getByte(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getChar(numProps);
+ fail("getChar(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getChar(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getDouble(numProps);
+ fail("getDouble(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getDouble(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getFloat(numProps);
+ fail("getFloat(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getFloat(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getInt(numProps);
+ fail("getInt(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getInt(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getLong(numProps);
+ fail("getLong(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getLong(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getShort(numProps);
+ fail("getShort(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getShort(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getBytes(numProps);
+ fail("getBytes(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBytes(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getBigDecimal(numProps);
+ fail("getBigDecimal(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBigDecimal(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getBigInteger(numProps);
+ fail("getBigInteger(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBigInteger(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getDataObject(numProps);
+ fail("getDataObject(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getDataObject(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getDate(numProps);
+ fail("getDate(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getDate(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getString(numProps);
+ fail("getString(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getString(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getList(numProps);
+ fail("getList(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). No Exception was thrown.");
+ } catch (IllegalArgumentException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getList(int) should throw an IllegalArgumentException when int >= getInstanceProperties.size(). " + e.getClass().getName() + " was thrown.");
+ }
+ }
+
+ /**
+ * Verifies the following statement.
+ * Using an Index out of range (index < 0 or >= getList(Property property).size())
+ * will result in an IndexOutOfBoundsException.
+ */
+ public void testListIndexOutOfBoundsException() {
+ List list = testDO.getList("listVal");
+
+// Not fixed in TUSCANY-578
+// try {
+// list.get(-1);
+// fail("list.get(-1) should throw an IndexOutOfBoundsException. No Exception was thrown.");
+// } catch (IndexOutOfBoundsException e) {
+// // Success - do nothing
+// } catch (Exception e) {
+// fail("list.get(-1) should throw an IndexOutOfBoundsException. " + e.getClass().getName() + " was thrown.");
+// }
+// try {
+// list.get(list.size());
+// fail("list.get(int) should throw an IndexOutOfBoundsException when int >= list.size(). No Exception was thrown.");
+// } catch (IndexOutOfBoundsException e) {
+// // Success - do nothing
+// } catch (Exception e) {
+// fail("list.get(int) should throw an IndexOutOfBoundsException when int >= list.size(). " + e.getClass().getName() + " was thrown.");
+// }
+// try {
+// list.remove(-1);
+// fail("list.remove(-1) should throw an IndexOutOfBoundsException. No Exception was thrown.");
+// } catch (IndexOutOfBoundsException e) {
+// // Success - do nothing
+// } catch (Exception e) {
+// fail("list.remove(-1) should throw an IndexOutOfBoundsException. " + e.getClass().getName() + " was thrown.");
+// }
+ try {
+ list.remove(list.size());
+ fail("list.remove(int) should throw an IndexOutOfBoundsException when int >= list.size(). No Exception was thrown.");
+ } catch (IndexOutOfBoundsException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("list.remove(int) should throw an IndexOutOfBoundsException when int >= list.size(). " + e.getClass().getName() + " was thrown.");
+ }
+ }
+
+ /**
+ * Verifies the following statement.
+ * Modification of a read-only property results in UnsupportedOperationException.
+ * This test case is for modifications done through the DataObject API.
+ */
+ public void testModifyReadOnlyUnsupportedOperationException() {
+ Property readOnlyProp = testDO.getInstanceProperty("readOnlyVal");
+ List properties = testDO.getInstanceProperties();
+ Property currProp;
+ int readOnlyIndex = -1, i = 0, size = properties.size();
+
+ // Verify the precondition
+ assertTrue("readOnlyVal should be read-only.", readOnlyProp.isReadOnly());
+
+ while (readOnlyIndex < 0 && i < size) {
+ currProp = (Property) properties.get(i);
+ if (currProp.equals(readOnlyProp))
+ readOnlyIndex = i;
+ i++;
+ }
+
+ try {
+ testDO.set("readOnlyVal", "NewValue");
+ fail("DataObject.set(string, value) should throw an UnsupportedOperationException when the Property represented by string is read-only. No Exception was thrown.");
+ } catch (UnsupportedOperationException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("DataObject.set(string, value) should throw an UnsupportedOperationException when the Property represented by string is read-only. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.set(readOnlyProp, "NewValue");
+ System.out.println("propname =" + readOnlyProp.getName());
+ fail("DataObject.set(property, value) should throw an UnsupportedOperationException when the Property represented by property is read-only. No Exception was thrown.");
+ } catch (UnsupportedOperationException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("DataObject.set(property, value) should throw an UnsupportedOperationException when the Property represented by property is read-only. " + e.getClass().getName() + " was thrown.");
+ }
+ assertTrue("The test case could not procede because the index of the read only Property was not found.", readOnlyIndex > -1);
+ try {
+ testDO.set(readOnlyIndex, "NewValue");
+ fail("DataObject.set(index, value) should throw an UnsupportedOperationException when the Property represented by index is read-only. No Exception was thrown.");
+ } catch (UnsupportedOperationException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("DataObject.set(index, value) should throw an UnsupportedOperationException when the Property represented by index is read-only. " + e.getClass().getName() + " was thrown.");
+ }
+
+ try {
+ testDO.unset("readOnlyVal");
+ fail("DataObject.unset(string) should throw an UnsupportedOperationException when the Property represented by string is read-only. No Exception was thrown.");
+ } catch (UnsupportedOperationException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("DataObject.unset(string) should throw an UnsupportedOperationException when the Property represented by string is read-only. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.unset(readOnlyProp);
+ fail("DataObject.unset(property) should throw an UnsupportedOperationException when the Property represented by property is read-only. No Exception was thrown.");
+ } catch (UnsupportedOperationException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("DataObject.unset(property) should throw an UnsupportedOperationException when the Property represented by property is read-only. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.unset(readOnlyIndex);
+ fail("DataObject.unset(index) should throw an UnsupportedOperationException when the Property represented by index is read-only. No Exception was thrown.");
+ } catch (UnsupportedOperationException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("DataObject.unset(index) should throw an UnsupportedOperationException when the Property represented by index is read-only. " + e.getClass().getName() + " was thrown.");
+ }
+ }
+
+ /**
+ * Verifies the following statement.
+ * Modification of a read-only property results in UnsupportedOperationException.
+ * This test case is for modification done through the List API.
+ */
+ public void testModifyReadOnlyUnsupportedOperationExceptionList() {
+ Property readOnlyProp = testDO.getInstanceProperty("readOnlyVal");
+ List properties = testDO.getInstanceProperties();
+ Property currProp;
+ int readOnlyIndex = -1, i = 0, size = properties.size();
+
+ while (readOnlyIndex < 0 && i < size) {
+ currProp = (Property) properties.get(i);
+ if (currProp.equals(readOnlyProp))
+ readOnlyIndex = i;
+ i++;
+ }
+
+// Not fixed in TUSCANY-578
+// try {
+// List temp = testDO.getList("readOnlyListVal");
+// temp.add("String to add.");
+// fail("DataObject.getList(path).add(value) should throw an UnsupportedOperationException when the Property represented by path is read-only. No Exception was thrown.");
+// } catch (UnsupportedOperationException e) {
+// // Success - do nothing
+// } catch (Exception e) {
+// fail("DataObject.getList(path).add(value) should throw an IllegalArgumentException when the Property represented by path is read-only. " + e.getClass().getName() + " was thrown.");
+// }
+// try {
+// Sequence temp = testDO.getSequence();
+// temp.add("readOnlyListVal", "String to add.");
+// fail("DataObject.getSequence().add(path, value) should throw an UnsupportedOperationException when the Property represtend by path is read-only. No Exception was thrown.");
+// } catch (UnsupportedOperationException e) {
+// // Success - do nothing
+// } catch (Exception e) {
+// fail("DataObject.getSequence().add(path, value) should throw an UnsupportedOperationException when the Property represtend by path is read-only. " + e.getClass().getName() + " was thrown.");
+// }
+ }
+
+ /**
+ * Verifies the following statement.
+ * Modification of a read-only property results in UnsupportedOperationException.
+ * This test case is for modification done through the List API.
+ */
+ public void testModifyReadOnlyUnsupportedOperationExceptionSequence() {
+ Property readOnlyProp = seqDO.getInstanceProperty("readOnlyVal");
+ List properties = seqDO.getInstanceProperties();
+ Property currProp;
+ int readOnlyIndex = -1, i = 0, size = properties.size();
+
+ while (readOnlyIndex < 0 && i < size) {
+ currProp = (Property) properties.get(i);
+ if (currProp.equals(readOnlyProp))
+ readOnlyIndex = i;
+ i++;
+ }
+
+// Not fixed in TUSCANY-578
+// try {
+// Sequence sequence = seqDO.getSequence();
+// sequence.add(readOnlyProp, "New Value");
+// fail("Sequence.add(property, value) should throw an UnsupportedOperationException when the Property represented by property is read-only. No Exception was thrown.");
+// } catch (UnsupportedOperationException e) {
+// // Success - do nothing
+// } catch (Exception e) {
+// fail("Sequence.add(property, value) should throw an UnsupportedOperationException when the Property represented by property is read-only. " + e.getClass().getName() + " was thrown.");
+// }
+ }
+
+ /**
+ * Verifies the following statement.
+ * A ClassCastException results when cannot convert between value and requested Type.
+ */
+
+ public void testCannotConvertClassCastException() {
+ // Attempt conversion from boolean
+
+ try {
+ testDO.getByte("booleanVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getChar("booleanVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getDouble("booleanVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getFloat("booleanVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getInt("booleanVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getLong("booleanVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getShort("booleanVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBytes("booleanVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBigDecimal("booleanVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBigInteger("booleanVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getDate("booleanVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+
+ // Attempt conversion from byte
+ try {
+ testDO.getBoolean("byteVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getChar("byteVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBigDecimal("byteVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBigInteger("byteVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getDate("byteVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBytes("byteVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ // Attempt conversion from character
+ try {
+ testDO.getBoolean("charVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getByte("charVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getDouble("charVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getFloat("charVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getInt("charVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getLong("charVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getShort("charVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBytes("charVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBigDecimal("charVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBigInteger("charVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getDate("charVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+
+// Attempt conversion from double
+ try {
+ testDO.getBoolean("doubleVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getChar("doubleVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBytes("doubleVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getDate("doubleVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+
+// Attempt conversion from float
+ try {
+ testDO.getBoolean("floatVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getChar("floatVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBytes("floatVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getDate("floatVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+
+// Attempt conversion from int
+ try {
+ testDO.getBoolean("intVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getChar("intVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBytes("intVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getDate("intVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+
+// Attempt conversion from long
+ try {
+ testDO.getBoolean("longVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getChar("longVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBytes("longVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+
+// Attempt conversion from short
+ try {
+ testDO.getBoolean("shortVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getChar("shortVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBytes("shortVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBigDecimal("shortVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBigInteger("shortVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getDate("shortVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+
+// Attempt conversion from bytes
+ try {
+ testDO.getBoolean("bytesVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getByte("bytesVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getChar("bytesVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getDouble("bytesVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getFloat("bytesVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getInt("bytesVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getLong("bytesVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getShort("bytesVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBigDecimal("bytesVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getDate("bytesVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+
+// Attempt conversion from decimal
+ try {
+ testDO.getBoolean("decimalVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getByte("decimalVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getChar("decimalVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getShort("decimalVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBytes("decimalVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getDate("decimalVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+
+// Attempt conversion from BigInteger
+ try {
+ testDO.getBoolean("integerVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getByte("integerVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getChar("integerVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getShort("integerVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getDate("integerVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+
+// Attempt conversion from date
+ try {
+ testDO.getBoolean("dateVal");
+ } catch (ClassCastException e) {
+ // success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getByte("dateVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getChar("dateVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getDouble("dateVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getFloat("dateVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getInt("dateVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getShort("dateVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBytes("dateVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBigDecimal("dateVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ try {
+ testDO.getBigInteger("dateVal");
+ } catch (ClassCastException e) {
+// success - do nothing
+ } catch (Exception e) {
+ fail("Attempted implicit unsupported conversion did not throw the correct Exception. Expected: ClassCastException. Received: " + e.getClass().getName());
+ }
+ }
+
+
+ /**
+ * Verifies the following statement.
+ * Mixing single-valued and multi-valued Property access results in
+ * ClassCastException.
+ */
+ public void testMixSingleMultiValueClassCastException() {
+ Property testedProp = testDO.getInstanceProperty("intVal");
+ List properties = testDO.getInstanceProperties();
+ Property currProp;
+ int testedIndex = -1, i = 0, size = properties.size();
+
+ while (testedIndex < 0 && i < size) {
+ currProp = (Property) properties.get(i);
+
+ if (currProp.equals(testedProp))
+ testedIndex = i;
+ i++;
+ }
+
+ try {
+ testDO.getList("intVal");
+ fail("getList(string) should throw a ClassCastException when the property represented by string is single-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getList(string) should throw a ClassCastException when the property represented by string is single-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getList(testedProp);
+ fail("getList(property) should throw a ClassCastException when the property represented by property is single-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getList(property) should throw a ClassCastException when the property represented by property is single-valued. " + e.getClass().getName() + " was thrown.");
+ }
+
+ assertTrue("The test case could not procede because the index of the single-valued Property was not found.", testedIndex > -1);
+
+ try {
+ testDO.getList(testedIndex);
+ fail("getList(index) should throw a ClassCastException when the property represented by index is single-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getList(index) should throw a ClassCastException when the property represented by index is single-valued. " + e.getClass().getName() + " was thrown.");
+ }
+
+ testedProp = testDO.getInstanceProperty("listVal");
+ testedIndex = -1;
+ i = 0;
+ while (testedIndex < 0 && i < size) {
+ currProp = (Property) properties.get(i);
+ if (currProp.equals(testedProp))
+ testedIndex = i;
+ i++;
+ }
+
+ try {
+ testDO.getBoolean("listVal");
+ fail("getBoolean(string) should throw a ClassCastException when the property represented by string is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBoolean(string) should throw a ClassCastException when the property represented by string is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getByte("listVal");
+ fail("getByte(string) should throw a ClassCastException when the property represented by string is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getByte(string) should throw a ClassCastException when the property represented by string is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getChar("listVal");
+ fail("getChar(string) should throw a ClassCastException when the property represented by string is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getChar(string) should throw a ClassCastException when the property represented by string is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getDouble("listVal");
+ fail("getDouble(string) should throw a ClassCastException when the property represented by string is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getDouble(string) should throw a ClassCastException when the property represented by string is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getFloat("listVal");
+ fail("getFloat(string) should throw a ClassCastException when the property represented by string is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getFloat(string) should throw a ClassCastException when the property represented by string is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getInt("listVal");
+ fail("getInt(string) should throw a ClassCastException when the property represented by string is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getInt(string) should throw a ClassCastException when the property represented by string is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getLong("listVal");
+ fail("getLong(string) should throw a ClassCastException when the property represented by string is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getLong(string) should throw a ClassCastException when the property represented by string is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getShort("listVal");
+ fail("getShort(string) should throw a ClassCastException when the property represented by string is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getShort(string) should throw a ClassCastException when the property represented by string is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getBytes("listVal");
+ fail("getBytes(string) should throw a ClassCastException when the property represented by string is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBytes(string) should throw a ClassCastException when the property represented by string is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getBigDecimal("listVal");
+ fail("getBigDecimal(string) should throw a ClassCastException when the property represented by string is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBigDecimal(string) should throw a ClassCastException when the property represented by string is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getBigInteger("listVal");
+ fail("getBigInteger(string) should throw a ClassCastException when the property represented by string is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBigInteger(string) should throw a ClassCastException when the property represented by string is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getDataObject("listVal");
+ fail("getDataObject(string) should throw a ClassCastException when the property represented by string is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getDataObject(string) should throw a ClassCastException when the property represented by string is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getDate("listVal");
+ fail("getDate(string) should throw a ClassCastException when the property represented by string is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getDate(string) should throw a ClassCastException when the property represented by string is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getString("listVal");
+ fail("getString(string) should throw a ClassCastException when the property represented by string is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getString(string) should throw a ClassCastException when the property represented by string is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+
+ try {
+ testDO.getBoolean(testedProp);
+ fail("getBoolean(property) should throw a ClassCastException when the property represented by property is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBoolean(property) should throw a ClassCastException when the property represented by property is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getByte(testedProp);
+ fail("getByte(property) should throw a ClassCastException when the property represented by property is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getByte(property) should throw a ClassCastException when the property represented by property is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getChar(testedProp);
+ fail("getChar(property) should throw a ClassCastException when the property represented by property is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getChar(property) should throw a ClassCastException when the property represented by property is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getDouble(testedProp);
+ fail("getDouble(property) should throw a ClassCastException when the property represented by property is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getDouble(property) should throw a ClassCastException when the property represented by property is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getFloat(testedProp);
+ fail("getFloat(property) should throw a ClassCastException when the property represented by property is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getFloat(property) should throw a ClassCastException when the property represented by property is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getInt(testedProp);
+ fail("getInt(property) should throw a ClassCastException when the property represented by property is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getInt(property) should throw a ClassCastException when the property represented by property is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getLong(testedProp);
+ fail("getLong(property) should throw a ClassCastException when the property represented by property is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getLong(property) should throw a ClassCastException when the property represented by property is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getShort(testedProp);
+ fail("getShort(property) should throw a ClassCastException when the property represented by property is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getShort(property) should throw a ClassCastException when the property represented by property is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getBytes(testedProp);
+ fail("getBytes(property) should throw a ClassCastException when the property represented by property is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBytes(property) should throw a ClassCastException when the property represented by property is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getBigDecimal(testedProp);
+ fail("getBigDecimal(property) should throw a ClassCastException when the property represented by property is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBigDecimal(property) should throw a ClassCastException when the property represented by property is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getBigInteger(testedProp);
+ fail("getBigInteger(property) should throw a ClassCastException when the property represented by property is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBigInteger(property) should throw a ClassCastException when the property represented by property is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getDataObject(testedProp);
+ fail("getDataObject(property) should throw a ClassCastException when the property represented by property is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getDataObject(property) should throw a ClassCastException when the property represented by property is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getDate(testedProp);
+ fail("getDate(property) should throw a ClassCastException when the property represented by property is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getDate(property) should throw a ClassCastException when the property represented by property is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getString(testedProp);
+ fail("getString(property) should throw a ClassCastException when the property represented by property is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getString(property) should throw a ClassCastException when the property represented by property is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+
+ assertTrue("The test case could not procede because the index of the multi-valued Property was not found.", testedIndex > -1);
+
+ try {
+ testDO.getBoolean(testedIndex);
+ fail("getBoolean(index) should throw a ClassCastException when the property represented by index is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBoolean(index) should throw a ClassCastException when the property represented by is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getByte(testedIndex);
+ fail("getByte(index) should throw a ClassCastException when the property represented by index is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getByte(index) should throw a ClassCastException when the property represented by index is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getChar(testedIndex);
+ fail("getChar(index) should throw a ClassCastException when the property represented by index is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getChar(index) should throw a ClassCastException when the property represented by index is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getDouble(testedIndex);
+ fail("getDouble(index) should throw a ClassCastException when the property represented by index is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getDouble(index) should throw a ClassCastException when the property represented by index is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getFloat(testedIndex);
+ fail("getFloat(index) should throw a ClassCastException when the property represented by index is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getFloat(index) should throw a ClassCastException when the property represented by index is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getInt(testedIndex);
+ fail("getInt(index) should throw a ClassCastException when the property represented by index is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getInt(index) should throw a ClassCastException when the property represented by index is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getLong(testedIndex);
+ fail("getLong(index) should throw a ClassCastException when the property represented by index is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getLong(index) should throw a ClassCastException when the property represented by index is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getShort(testedIndex);
+ fail("getShort(index) should throw a ClassCastException when the property represented by index is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getShort(index) should throw a ClassCastException when the property represented by index is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getBytes(testedIndex);
+ fail("getBytes(index) should throw a ClassCastException when the property represented by index is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
+ fail("getBytes(index) should throw a ClassCastException when the property represented by index is multi-valued. " + e.getClass().getName() + " was thrown.");
+ }
+ try {
+ testDO.getBigDecimal(testedIndex);
+ fail("getBigDecimal(index) should throw a ClassCastException when the property represented by index is multi-valued. No Exception was thrown.");
+ } catch (ClassCastException e) {
+ // Success - do nothing
+ } catch (Exception e) {
[... 267 lines stripped ...]
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org