8004066: TEST_BUG: test/java/lang/Math/DivModTests.java assumes ArithmeticException message
authorkmo
Tue, 04 Dec 2012 15:10:03 +0000
changeset 14703 84efc7a1216e
parent 14702 111342b28e67
child 14704 e7924bf18a73
child 14757 1da20d79c7c5
8004066: TEST_BUG: test/java/lang/Math/DivModTests.java assumes ArithmeticException message Reviewed-by: twisti, alanb, dholmes
jdk/test/java/lang/Math/DivModTests.java
--- a/jdk/test/java/lang/Math/DivModTests.java	Tue Dec 04 14:07:30 2012 +0000
+++ b/jdk/test/java/lang/Math/DivModTests.java	Tue Dec 04 15:10:03 2012 +0000
@@ -65,7 +65,7 @@
      * Math and StrictMath tested and the same results are expected for both.
      */
     static void testIntFloorDivMod() {
-        testIntFloorDivMod(4, 0, new ArithmeticException("/ by zero"), new ArithmeticException("/ by zero")); // Should throw ArithmeticException
+        testIntFloorDivMod(4, 0, new ArithmeticException(), new ArithmeticException()); // Should throw ArithmeticException
         testIntFloorDivMod(4, 3, 1, 1);
         testIntFloorDivMod(3, 3, 1, 0);
         testIntFloorDivMod(2, 3, 0, 2);
@@ -151,7 +151,7 @@
      * Test the floorDiv and floorMod methods for primitive long.
      */
     static void testLongFloorDivMod() {
-        testLongFloorDivMod(4L, 0L, new ArithmeticException("/ by zero"), new ArithmeticException("/ by zero")); // Should throw ArithmeticException
+        testLongFloorDivMod(4L, 0L, new ArithmeticException(), new ArithmeticException()); // Should throw ArithmeticException
         testLongFloorDivMod(4L, 3L, 1L, 1L);
         testLongFloorDivMod(3L, 3L, 1L, 0L);
         testLongFloorDivMod(2L, 3L, 0L, 2L);
@@ -385,9 +385,7 @@
         }
         // Handle special case to compare ArithmeticExceptions
         if (result instanceof ArithmeticException && expected instanceof ArithmeticException) {
-            ArithmeticException ae1 = (ArithmeticException)result;
-            ArithmeticException ae2 = (ArithmeticException)expected;
-            return ae1.getMessage().equals(ae2.getMessage());
+            return true;
         }
         return false;
     }