harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r450800 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java: org/apache/harmony/luni/tests/java/io/ org/apache/harmony/luni/tests/java/lang/ org/apache/harmony/tests/java/lang/ tests/api/java/io/ tests/api/java/util/
Date Thu, 28 Sep 2006 10:48:51 GMT
Author: tellison
Date: Thu Sep 28 03:48:50 2006
New Revision: 450800

URL: http://svn.apache.org/viewvc?view=rev&rev=450800
Log:
Apply patch HARMONY-1618 ([classlib][luni] Some "fail" statements of exception-catching test
cases missed in luni module)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/io/FileInputStreamTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/io/FileOutputStreamTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/io/ObjectInputStreamTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ClassTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/lang/EnumTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/BufferedInputStreamTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/InputStreamReaderTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/CollectionsTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/LinkedListTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ScannerTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/io/FileInputStreamTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/io/FileInputStreamTest.java?view=diff&rev=450800&r1=450799&r2=450800
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/io/FileInputStreamTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/io/FileInputStreamTest.java
Thu Sep 28 03:48:50 2006
@@ -27,13 +27,15 @@
      */
     public void test_read$BII() throws Exception {
         // Regression test for HARMONY-285
+        File file = new File("FileInputStream.tmp");
+        file.createNewFile();
+        file.deleteOnExit();
+        FileInputStream in = new FileInputStream(file);
         try {
-            File file = new File("FileInputStream.tmp");
-            file.createNewFile();
-            file.deleteOnExit();
-            FileInputStream in = new FileInputStream(file);
             in.read(null, 0, 0);
+            fail("Should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/io/FileOutputStreamTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/io/FileOutputStreamTest.java?view=diff&rev=450800&r1=450799&r2=450800
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/io/FileOutputStreamTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/io/FileOutputStreamTest.java
Thu Sep 28 03:48:50 2006
@@ -27,12 +27,14 @@
      */
     public void test_write$BII() throws Exception {
         // Regression test for HARMONY-285
+        File file = new File("FileOutputStream.tmp");
+        file.deleteOnExit();
+        FileOutputStream out = new FileOutputStream(file);
         try {
-            File file = new File("FileOutputStream.tmp");
-            file.deleteOnExit();
-            FileOutputStream out = new FileOutputStream(file);
             out.write(null, 0, 0);
+            fail("Should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/io/ObjectInputStreamTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/io/ObjectInputStreamTest.java?view=diff&rev=450800&r1=450799&r2=450800
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/io/ObjectInputStreamTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/io/ObjectInputStreamTest.java
Thu Sep 28 03:48:50 2006
@@ -106,6 +106,7 @@
     public void test_readClassDescriptor() throws ClassNotFoundException,IOException {
         try {
             new OIS().test();
+            fail("Should throw NullPointerException");
         } catch (NullPointerException e) {
             // expected
         }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ClassTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ClassTest.java?view=diff&rev=450800&r1=450799&r2=450800
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ClassTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ClassTest.java
Thu Sep 28 03:48:50 2006
@@ -428,6 +428,7 @@
         try {
             // Invoking private non-sub, non-package
             m.invoke(new TestClass());
+            fail("Should throw IllegalAccessException");
         } catch (IllegalAccessException e) {
             // Correct
             return;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/lang/EnumTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/lang/EnumTest.java?view=diff&rev=450800&r1=450799&r2=450800
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/lang/EnumTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/lang/EnumTest.java
Thu Sep 28 03:48:50 2006
@@ -54,6 +54,7 @@
         assertTrue(0 > Sample.MOE.compareTo(Sample.CURLY));
         try {
             Sample.MOE.compareTo((Sample)null);
+            fail("Should throw NullPointerException");
         } catch (NullPointerException e) {
             // Expected
         }
@@ -122,6 +123,7 @@
         }
         try {
             Sample.valueOf(null);
+            fail("Should throw NullPointerException");
         } catch (NullPointerException e) {
             // May be caused by some compilers' code
         } catch (IllegalArgumentException e) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/BufferedInputStreamTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/BufferedInputStreamTest.java?view=diff&rev=450800&r1=450799&r2=450800
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/BufferedInputStreamTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/BufferedInputStreamTest.java
Thu Sep 28 03:48:50 2006
@@ -114,20 +114,17 @@
 	}
 
 	/**
+	 * @throws IOException 
 	 * @tests java.io.BufferedInputStream#close()
 	 */
-	public void test_close() {
+	public void test_close() throws IOException {
 		// Test for method void java.io.BufferedInputStream.close()
 		new BufferedInputStream(isFile);
 		new BufferedInputStream(isFile);
 		
 		//regression for HARMONY-667
         BufferedInputStream buf = new BufferedInputStream(null, 5);
-        try {
-            buf.close();
-        } catch (IOException e) {
-            //expected
-        }                         
+        buf.close();                           
 	}
 
 	/**
@@ -397,6 +394,7 @@
         BufferedInputStream buf = new BufferedInputStream(null, 5);
         try {
             buf.skip(10);
+            fail("Should throw IOException");
         } catch (IOException e) {
             //expected
         }                         

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/InputStreamReaderTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/InputStreamReaderTest.java?view=diff&rev=450800&r1=450799&r2=450800
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/InputStreamReaderTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/InputStreamReaderTest.java
Thu Sep 28 03:48:50 2006
@@ -425,9 +425,11 @@
 			fail("Failed to close reader : " + e.getMessage());
 		}
 		try {
-			is.read();
-		} catch (IOException e) {
-		} // Exception means read failed due to close
+            is.read();
+            fail("Should throw IOException");
+        } catch (IOException e) {
+            // Exception means read failed due to close
+        } 
 
 	}
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/CollectionsTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/CollectionsTest.java?view=diff&rev=450800&r1=450799&r2=450800
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/CollectionsTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/CollectionsTest.java
Thu Sep 28 03:48:50 2006
@@ -1586,11 +1586,10 @@
 		
 		try {
 			c.remove(new Object());
+            fail("Allowed modification of collection");
 		} catch (UnsupportedOperationException e) {
 			// Correct
-			return;
-		}
-		fail("Allowed modification of collection");
+		}		
 
 		Collection myCollection = new ArrayList();
 		myCollection.add(new Integer(20));
@@ -1645,11 +1644,10 @@
 		
 		try {
 			c.remove(new Object());
+            fail("Allowed modification of list");
 		} catch (UnsupportedOperationException e) {
 			// Correct
-			return;
-		}
-		fail("Allowed modification of list");
+		}		
 
 		// test with a Random Access List
 		List smallList = new ArrayList();
@@ -1788,11 +1786,10 @@
 		}
 		try {
 			c.remove(new Object());
+            fail("Allowed modification of set");
 		} catch (UnsupportedOperationException e) {
 			// Correct
-			return;
-		}
-		fail("Allowed modification of set");
+		}		
 
 		Set mySet = Collections.unmodifiableSet(new HashSet());
 		assertTrue("Should not contain null", !mySet.contains(null));

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/LinkedListTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/LinkedListTest.java?view=diff&rev=450800&r1=450799&r2=450800
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/LinkedListTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/LinkedListTest.java
Thu Sep 28 03:48:50 2006
@@ -356,11 +356,11 @@
 		assertEquals("Failed to remove element", -1, ll.indexOf(objArray[10]));
 		try {
 			ll.remove(999);
+            fail("Failed to throw expected exception when index out of range");
 		} catch (IndexOutOfBoundsException e) {
 			// Correct
-			return;
 		}
-		fail("Failed to throw expected exception when index out of range");
+		
 		ll.add(20, null);
 		ll.remove(20);
 		assertNotNull("Should have removed null", ll.get(20));

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ScannerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ScannerTest.java?view=diff&rev=450800&r1=450799&r2=450800
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ScannerTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ScannerTest.java
Thu Sep 28 03:48:50 2006
@@ -353,6 +353,7 @@
         // thrown out.
         try {
             fos.write(12);
+            fail("Should throw IOException");
         } catch (IOException e) {
             // expected
         }



Mime
View raw message