harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r590017 [1/2] - in /harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected: javax/swing/ javax/swing/plaf/metal/ javax/swing/text/ org/apache/harmony/swing/tests/javax/swing/text/html/parser/ org/apache/harmony/swing/tests...
Date Tue, 30 Oct 2007 10:11:08 GMT
Author: odeakin
Date: Tue Oct 30 03:11:07 2007
New Revision: 590017

URL: http://svn.apache.org/viewvc?rev=590017&view=rev
Log:
Let JUnit deal with unexpected Exceptions rather than catching them ourselves - swing module.

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/AbstractButtonTest.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/JEditorPaneTest.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/JListRTest.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/plaf/metal/MetalBordersTest.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/UtilitiesTest.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/org/apache/harmony/swing/tests/javax/swing/text/html/parser/DTDTest.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/org/apache/harmony/swing/tests/javax/swing/text/parser/ContentModelCompatilityTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/AbstractButtonTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/AbstractButtonTest.java?rev=590017&r1=590016&r2=590017&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/AbstractButtonTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/AbstractButtonTest.java
Tue Oct 30 03:11:07 2007
@@ -996,30 +996,28 @@
         String exceptionText = "exceptionText";
         int res = button.checkVerticalKey(SwingConstants.TOP, exceptionText);
         assertEquals("returned value ", 1, res);
-        Throwable exception = null;
         try {
             res = button.checkVerticalKey(SwingConstants.WEST, exceptionText);
-        } catch (Exception e) {
-            exception = e;
+        } catch (IllegalArgumentException e) {
+            assertEquals("exception's message ", exceptionText, e.getMessage());
+            return;
         }
-        assertTrue("exception's been thrown ", exception != null);
-        assertEquals("exception's class ", IllegalArgumentException.class, exception.getClass());
-        assertEquals("exception's message ", exceptionText, exception.getMessage());
+
+        fail("Expected IllegalArgumentException to be thrown");
     }
 
     public void testCheckHorizontalKey() {
         String exceptionText = "exceptionText";
         int res = button.checkHorizontalKey(SwingConstants.TRAILING, exceptionText);
         assertEquals("returned value ", SwingConstants.TRAILING, res);
-        Throwable exception = null;
         try {
             res = button.checkHorizontalKey(SwingConstants.TOP, exceptionText);
-        } catch (Exception e) {
-            exception = e;
+        } catch (IllegalArgumentException e) {
+            assertEquals("exception's message ", exceptionText, e.getMessage());
+            return;
         }
-        assertTrue("exception's been thrown ", exception != null);
-        assertEquals("exception's class ", IllegalArgumentException.class, exception.getClass());
-        assertEquals("exception's message ", exceptionText, exception.getMessage());
+        
+        fail("Expected IllegalArgumentException to be thrown");
     }
 
     public void testCreateActionPropertyChangeListener() {

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/JEditorPaneTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/JEditorPaneTest.java?rev=590017&r1=590016&r2=590017&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/JEditorPaneTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/JEditorPaneTest.java
Tue Oct 30 03:11:07 2007
@@ -460,15 +460,11 @@
                 "javax.swing.text.html.HTMLEditorKit", "text/html", TEST_URL, jep);
     }
 
-    public void testJEditorPaneJarHTML() {
-        try {
-            // Regression for HARMONY-4529
-            URL jar = getClass().getResource("testhtml.jar");
-            URL url = new URL("jar:" + jar + "!/index.html");
-            new JEditorPane(url);
-        } catch (Exception e) {
-            fail("Unexpected exception: " + e);
-        }
+    public void testJEditorPaneJarHTML() throws Exception {
+        // Regression for HARMONY-4529
+        URL jar = getClass().getResource("testhtml.jar");
+        URL url = new URL("jar:" + jar + "!/index.html");
+        new JEditorPane(url);
     }
 
     private void assertEquals(final ArrayList<HyperlinkListener> a, final Object objects[])
{

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/JListRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/JListRTest.java?rev=590017&r1=590016&r2=590017&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/JListRTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/JListRTest.java
Tue Oct 30 03:11:07 2007
@@ -24,12 +24,8 @@
 
 public class JListRTest extends TestCase {
     public void testAddSelectionInterval() throws Exception {
-        try {
-            JList jl = new JList();
-            jl.addSelectionInterval(10000000, 1);
-        } catch (Exception e) {
-            fail("Unexpected exception :" + e);
-        }
+        JList jl = new JList();
+        jl.addSelectionInterval(10000000, 1);
     }
 
     public void testSetSelectedIndicies() throws Exception {

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/plaf/metal/MetalBordersTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/plaf/metal/MetalBordersTest.java?rev=590017&r1=590016&r2=590017&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/plaf/metal/MetalBordersTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/plaf/metal/MetalBordersTest.java
Tue Oct 30 03:11:07 2007
@@ -190,7 +190,8 @@
         try {
             border.getBorderInsets(new JButton());
             fail("should throw ClassCastException");
-        } catch (Exception e) {
+        } catch (ClassCastException e) {
+            // Expected
         }
         checkInsets(border, testToolBar);
     }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/UtilitiesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/UtilitiesTest.java?rev=590017&r1=590016&r2=590017&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/UtilitiesTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/UtilitiesTest.java
Tue Oct 30 03:11:07 2007
@@ -828,14 +828,10 @@
         assertEquals(-1, Utilities.getRowEnd(c, 6));
     }
 
-    public void testGetRowStartEnd() {
-        try {
-            getRowStartEndTest(jta);
-            //getRowStartEndTest(jtp);
-            getRowStartEndTest(jtf);
-        } catch (Exception e) {
-            assertFalse("Unexpected exception", true);
-        }
+    public void testGetRowStartEnd() throws Exception {
+        getRowStartEndTest(jta);
+        //getRowStartEndTest(jtp);
+        getRowStartEndTest(jtf);
     }
 
     void getPreviousWordTest(final JTextComponent c) {

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/org/apache/harmony/swing/tests/javax/swing/text/html/parser/DTDTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/org/apache/harmony/swing/tests/javax/swing/text/html/parser/DTDTest.java?rev=590017&r1=590016&r2=590017&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/org/apache/harmony/swing/tests/javax/swing/text/html/parser/DTDTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/org/apache/harmony/swing/tests/javax/swing/text/html/parser/DTDTest.java
Tue Oct 30 03:11:07 2007
@@ -35,10 +35,8 @@
             Element e = dtd.getElement(-1);
             fail("IndexOutOfBoundsException wasn't raised as RI, but method returned: " +
e);
         } catch (IndexOutOfBoundsException e) {
-        } catch (Exception e) {
-            fail(e.getClass().getName()
-                    + " raised but IndexOutOfBoundsException had to be raised");
-        }
+            // Expected
+        } 
     }
 
     public void testGetElementUpperOutOfBounds() {
@@ -46,9 +44,7 @@
             Element e = dtd.getElement(dtd.elements.size());
             fail("IndexOutOfBoundsException didn't raised as RI, but method returned: " +
e);
         } catch (IndexOutOfBoundsException e) {
-        } catch (Exception e) {
-            fail(e.getClass().getName()
-                    + " raised but IndexOutOfBoundsException had to be raised");
+            // Expected
         }
     }
 }



Mime
View raw message