harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r588615 - in /harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java: common/java/awt/ common/java/awt/image/ unix/org/apache/harmony/awt/gl/font/
Date Fri, 26 Oct 2007 11:58:40 GMT
Author: odeakin
Date: Fri Oct 26 04:58:40 2007
New Revision: 588615

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

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/BorderLayoutRTest.java
    harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/CardLayoutRTest.java
    harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/FlowLayoutRTest.java
    harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/GridBagLayoutRTest.java
    harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/GridLayoutRTest.java
    harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/MenuBarTest.java
    harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/BufferedImageFilterTest.java
    harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/unix/org/apache/harmony/awt/gl/font/LineMetricsImplRTest.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/BorderLayoutRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/BorderLayoutRTest.java?rev=588615&r1=588614&r2=588615&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/BorderLayoutRTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/BorderLayoutRTest.java
Fri Oct 26 04:58:40 2007
@@ -38,67 +38,35 @@
     }
     
     public final void testGetLayoutAlignmentX1() {
-        try {
-            layout.getLayoutAlignmentX(null);
-        } catch (Throwable t) {
-            fail();
-        }        
+        layout.getLayoutAlignmentX(null);
     }
     
     public final void testGetLayoutAlignmentX2() {        
-        try {
-            layout.getLayoutAlignmentX(emptyContainer);
-        } catch (Throwable t) {
-            fail();
-        }        
+        layout.getLayoutAlignmentX(emptyContainer);
     }
     
     public final void testGetLayoutAlignmentY1() {
-        try {
-            layout.getLayoutAlignmentY(null);
-        } catch (Throwable t) {
-            fail();
-        }        
+        layout.getLayoutAlignmentY(null);
     }
     
     public final void testGetLayoutAlignmentY2() {        
-        try {
-            layout.getLayoutAlignmentY(emptyContainer);
-        } catch (Throwable t) {
-            fail();
-        }        
+        layout.getLayoutAlignmentY(emptyContainer);
     }
     
     public final void testInvalidateLayout1() {
-        try {
-            layout.invalidateLayout(null);
-        } catch (Throwable t) {
-            fail();
-        }        
+        layout.invalidateLayout(null);
     }
     
     public final void testInvalidateLayout2() {        
-        try {
-            layout.invalidateLayout(emptyContainer);
-        } catch (Throwable t) {
-            fail();
-        }        
+        layout.invalidateLayout(emptyContainer);
     }
     
     public final void testMaximumLayoutSize1() {
-        try {
-            assertEquals(maxSize, layout.maximumLayoutSize(null));
-        } catch (Throwable t) {
-            fail();
-        }        
+        assertEquals(maxSize, layout.maximumLayoutSize(null));
     }
     
     public final void testMaximumLayoutSize2() {        
-        try {
-            assertEquals(maxSize, layout.maximumLayoutSize(emptyContainer));
-        } catch (Throwable t) {
-            fail();
-        }        
+        assertEquals(maxSize, layout.maximumLayoutSize(emptyContainer));
     }
 
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/CardLayoutRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/CardLayoutRTest.java?rev=588615&r1=588614&r2=588615&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/CardLayoutRTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/CardLayoutRTest.java
Fri Oct 26 04:58:40 2007
@@ -43,40 +43,24 @@
         } catch (IllegalArgumentException iae) {
             return;            
         }
-        fail();
+        fail("Expected IllegalArgumentException");
     }
 
     
     public final void testGetLayoutAlignmentX1() {
-        try {
-            layout.getLayoutAlignmentX(null);
-        } catch (Throwable t) {
-            fail();
-        }        
+        layout.getLayoutAlignmentX(null);
     }
     
     public final void testGetLayoutAlignmentX2() {        
-        try {
-            layout.getLayoutAlignmentX(emptyContainer);
-        } catch (Throwable t) {
-            fail();
-        }        
+        layout.getLayoutAlignmentX(emptyContainer);
     }
     
     public final void testGetLayoutAlignmentY1() {
-        try {
-            layout.getLayoutAlignmentY(null);
-        } catch (Throwable t) {
-            fail();
-        }        
+        layout.getLayoutAlignmentY(null);
     }
     
     public final void testGetLayoutAlignmentY2() {        
-        try {
-            layout.getLayoutAlignmentY(emptyContainer);
-        } catch (Throwable t) {
-            fail();
-        }        
+        layout.getLayoutAlignmentY(emptyContainer);
     }
     
     public void testLast() {        
@@ -85,32 +69,20 @@
         } catch (IllegalArgumentException iae) {
             return;            
         }
-        fail();
+        fail("Expected IllegalArgumentException");
     }
     
     public void testLayoutContainer() {       
-        try {
-            layout.layoutContainer(emptyContainer);
-        } catch (Throwable t) {
-            fail();
-        }
+        layout.layoutContainer(emptyContainer);
         assertTrue(true);
     }
     
     public final void testMaximumLayoutSize1() {
-        try {
-            assertEquals(maxSize, layout.maximumLayoutSize(null));
-        } catch (Throwable t) {
-            fail();
-        }        
+        assertEquals(maxSize, layout.maximumLayoutSize(null));
     }
     
     public final void testMaximumLayoutSize2() {        
-        try {
-            assertEquals(maxSize, layout.maximumLayoutSize(emptyContainer));
-        } catch (Throwable t) {
-            fail();
-        }        
+        assertEquals(maxSize, layout.maximumLayoutSize(emptyContainer));
     }
 
 
@@ -124,7 +96,7 @@
         } catch (IllegalArgumentException iae) {
             return;            
         }
-        fail();
+        fail("Expected IllegalArgumentException");
     }
     
     public final void testPreferredLayoutSize() {
@@ -137,15 +109,11 @@
         } catch (IllegalArgumentException iae) {
             return;            
         }
-        fail();
+        fail("Expected IllegalArgumentException");
     }
     
     public void testRemoveLayoutComponent() {       
-        try {
-            layout.removeLayoutComponent(emptyContainer);
-        } catch (Throwable t) {
-            fail();
-        }
+        layout.removeLayoutComponent(emptyContainer);
     }
     
 }

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/FlowLayoutRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/FlowLayoutRTest.java?rev=588615&r1=588614&r2=588615&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/FlowLayoutRTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/FlowLayoutRTest.java
Fri Oct 26 04:58:40 2007
@@ -48,27 +48,15 @@
     }
     
     public final void testLayoutContainer() {        
-        try {
-            layout.layoutContainer(emptyContainer);
-        } catch (Throwable t) {
-            fail();
-        }
+        layout.layoutContainer(emptyContainer);
     }
     
     public void testSetAlignment() {
-        try {
-            layout.setAlignment(-1);
-        } catch (Throwable t) {
-            fail();
-        }        
+        layout.setAlignment(-1);
     }
     
     public void testRemoveLayoutComponent() {        
-        try {
-            layout.removeLayoutComponent(null);
-        } catch (Throwable t) {
-            fail();
-        }
+        layout.removeLayoutComponent(null);
     }
 
 }

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/GridBagLayoutRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/GridBagLayoutRTest.java?rev=588615&r1=588614&r2=588615&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/GridBagLayoutRTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/GridBagLayoutRTest.java
Fri Oct 26 04:58:40 2007
@@ -111,11 +111,7 @@
     
     public final void testInvalidate() {
         GridBagLayout gbl = new GridBagLayout();
-        try {
-            gbl.invalidateLayout(null);
-        } catch (Throwable t) {
-            fail();
-        }
+        gbl.invalidateLayout(null);
     }
     
     static void addToGridBag(Panel panel, Component comp, int x, int y, int w,

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/GridLayoutRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/GridLayoutRTest.java?rev=588615&r1=588614&r2=588615&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/GridLayoutRTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/GridLayoutRTest.java
Fri Oct 26 04:58:40 2007
@@ -48,19 +48,11 @@
     }
     
     public final void testLayoutContainer() {        
-        try {
-            layout.layoutContainer(emptyContainer);
-        } catch (Throwable t) {
-            fail();
-        }
+        layout.layoutContainer(emptyContainer);
     }
     
     public void testRemoveLayoutComponent() {        
-        try {
-            layout.removeLayoutComponent(emptyContainer);
-        } catch (Throwable t) {
-            fail();
-        }
+        layout.removeLayoutComponent(emptyContainer);
     }
 
 }

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/MenuBarTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/MenuBarTest.java?rev=588615&r1=588614&r2=588615&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/MenuBarTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/MenuBarTest.java
Fri Oct 26 04:58:40 2007
@@ -116,21 +116,13 @@
     
     public void testRemove1() {
         MenuBar m = new MenuBar();
-        try {
-            m.remove(null);
-            assertTrue(true);
-        } catch (Throwable t) {
-            fail("Unexpected exception : " + t);
-        }
+        m.remove(null);
+        assertTrue(true);
     }
     
     public void testSetHelpMenu() {
         MenuBar m = new MenuBar();
-        try {
-            m.setHelpMenu(null);
-            assertTrue(true);
-        } catch (Throwable t) {
-            fail("Unexpected exception : " + t);
-        }
+        m.setHelpMenu(null);
+        assertTrue(true);
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/BufferedImageFilterTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/BufferedImageFilterTest.java?rev=588615&r1=588614&r2=588615&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/BufferedImageFilterTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/BufferedImageFilterTest.java
Fri Oct 26 04:58:40 2007
@@ -72,9 +72,8 @@
             new BufferedImageFilter(null);
             fail("Should throw NullPointerException, but was not.");
         } catch (NullPointerException e) {
-        } catch (Exception e) {
-            fail("NullPointerException expected");
-        }
+            // Expected
+        } 
     }
 
     public void testGetBufferedImageOp() throws Exception {

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/unix/org/apache/harmony/awt/gl/font/LineMetricsImplRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/unix/org/apache/harmony/awt/gl/font/LineMetricsImplRTest.java?rev=588615&r1=588614&r2=588615&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/unix/org/apache/harmony/awt/gl/font/LineMetricsImplRTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/unix/org/apache/harmony/awt/gl/font/LineMetricsImplRTest.java
Fri Oct 26 04:58:40 2007
@@ -32,14 +32,9 @@
             Font font = new Font("Dialog", Font.PLAIN, 12);
             FontRenderContext frc = new FontRenderContext(null, false, false);
             final int count = 100;
-        try {
+
             for (int i = 0; i < count; i++) {
                 LineMetrics lm = font.getLineMetrics("", frc);
             }
-        } catch (Exception e) {
-            if (e.getMessage().indexOf("Error opening TrueType font file.") != -1){
-                fail("NPE \"Error opening TrueType font file.\" caught.");
-            }
-        }
     }
 }



Mime
View raw message