tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agr...@apache.org
Subject svn commit: r553220 - /incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/DateConversionTest.java
Date Wed, 04 Jul 2007 14:34:00 GMT
Author: agrove
Date: Wed Jul  4 07:33:59 2007
New Revision: 553220

URL: http://svn.apache.org/viewvc?view=rev&rev=553220
Log:
DateConversionTest now shows meaningful information when comparisons fail to make it easier
for an implementor to track down the cause of the test failing

Modified:
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/DateConversionTest.java

Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/DateConversionTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/DateConversionTest.java?view=diff&rev=553220&r1=553219&r2=553220
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/DateConversionTest.java
(original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/DateConversionTest.java
Wed Jul  4 07:33:59 2007
@@ -176,11 +176,9 @@
 
             try {
                 result = (String)conversion.invoke(data_helper, parm);
+                assertNotNull( result );
 
-                assertTrue("The expected value did not result when calling " + conversion.getName()
-                    + " after initializing with "
-                    + this.from_type
-                    + ".", compareFields(parm[0], result, compare_fields));
+                compareFields(parm[0], result, compare_fields);
             } catch (Exception e) {
                 e.printStackTrace();
                 fail("An unexpected exception was thrown while calling " + conversion.getName()
@@ -192,8 +190,9 @@
 
         }
 
-        private boolean compareFields(Object compare_to, String output, int[] compare_fields)
{
+        private void compareFields(Object compare_to, String output, int[] compare_fields)
{
             Calendar result = data_helper.toCalendar(output);
+            assertNotNull( "data_helper.toCalendar(" + output + ") should not return null",
result );
             Calendar expected;
 
             if (compare_to instanceof Calendar)
@@ -204,10 +203,12 @@
             }
 
             for (int i = 0; i < compare_fields.length; i++) {
-                if (expected.get(compare_fields[i]) != result.get(compare_fields[i]))
-                    return false;
+                int expectedValue = expected.get(compare_fields[i]);
+                int actualValue = result.get(compare_fields[i]);
+                if (expectedValue != actualValue) {
+                      throw new IllegalStateException( "Expected: [" + expectedValue + "]
!= Actual: [" + actualValue + "]" );
+                  }
             }
-            return true;
         }
 
     }



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


Mime
View raw message