harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r612569 [2/2] - in /harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests: internal/net/www/protocol/file/ internal/net/www/protocol/http/ internal/net/www/protocol/https/ java/io/
Date Wed, 16 Jan 2008 20:56:06 GMT
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/ByteArrayOutputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/ByteArrayOutputStreamTest.java?rev=612569&r1=612568&r2=612569&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/ByteArrayOutputStreamTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/ByteArrayOutputStreamTest.java Wed Jan 16 12:56:03 2008
@@ -18,8 +18,9 @@
 package org.apache.harmony.luni.tests.java.io;
 
 import java.io.ByteArrayOutputStream;
-import java.io.FileOutputStream;
 import java.io.FileDescriptor;
+import java.io.FileOutputStream;
+import java.io.IOException;
 
 import junit.framework.TestCase;
 
@@ -28,187 +29,165 @@
  * 
  * @see java.io.ByteArrayOutputStream
  */
-
 public class ByteArrayOutputStreamTest extends TestCase {
 
-	ByteArrayOutputStream bos = null;
+    ByteArrayOutputStream bos = null;
 
-	public String fileString = "Test_All_Tests\nTest_java_io_BufferedInputStream\nTest_java_io_BufferedOutputStream\nTest_java_io_ByteArrayInputStream\nTest_ByteArrayOutputStream\nTest_java_io_DataInputStream\n";
+    public String fileString = "Test_All_Tests\nTest_java_io_BufferedInputStream\nTest_java_io_BufferedOutputStream\nTest_java_io_ByteArrayInputStream\nTest_ByteArrayOutputStream\nTest_java_io_DataInputStream\n";
 
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() throws Exception {
-		try {
-			bos.close();
-		} catch (Exception ignore) {
-		}
+    /**
+     * Tears down the fixture, for example, close a network connection. This
+     * method is called after a test is executed.
+     */
+    protected void tearDown() throws Exception {
+        try {
+            bos.close();
+        } catch (Exception ignore) {
+        }
         super.tearDown();
-	}
+    }
 
-	/**
-	 * @tests java.io.ByteArrayOutputStream#ByteArrayOutputStream(int)
-	 */
-	public void test_ConstructorI() {
-		// Test for method java.io.ByteArrayOutputStream(int)
-		bos = new java.io.ByteArrayOutputStream(100);
-		assertEquals("Failed to create stream", 0, bos.size());
-	}
-
-	/**
-	 * @tests java.io.ByteArrayOutputStream#ByteArrayOutputStream()
-	 */
-	public void test_Constructor() {
-		// Test for method java.io.ByteArrayOutputStream()
-		bos = new java.io.ByteArrayOutputStream();
-		assertEquals("Failed to create stream", 0, bos.size());
-	}
-
-	/**
-	 * @tests java.io.ByteArrayOutputStream#close()
-	 */
-	public void test_close() {
-		// Test for method void java.io.ByteArrayOutputStream.close()
-
-		assertTrue(
-				"close() does nothing for this implementation of OutputSteam",
-				true);
-
-		// The spec seems to say that a closed output stream can't be written
-		// to. We don't throw an exception if attempt is made to write.
-		// Right now our implementation doesn't do anything testable but
-		// should we decide to throw an exception if a closed stream is
-		// written to, the appropriate test is commented out below.
-
-		/***********************************************************************
-		 * java.io.ByteArrayOutputStream bos = new
-		 * java.io.ByteArrayOutputStream(); bos.write (fileString.getBytes(), 0,
-		 * 100); try { bos.close(); } catch (java.io.IOException e) {
-		 * fail("IOException closing stream"); } try { bos.write
-		 * (fileString.getBytes(), 0, 100); bos.toByteArray(); fail("Wrote
-		 * to closed stream"); } catch (Exception e) { }
-		 **********************************************************************/
-	}
-
-	/**
-	 * @tests java.io.ByteArrayOutputStream#reset()
-	 */
-	public void test_reset() {
-		// Test for method void java.io.ByteArrayOutputStream.reset()
-		bos = new java.io.ByteArrayOutputStream();
-		bos.write(fileString.getBytes(), 0, 100);
-		bos.reset();
-		assertEquals("reset failed", 0, bos.size());
-	}
-
-	/**
-	 * @tests java.io.ByteArrayOutputStream#size()
-	 */
-	public void test_size() {
-		// Test for method int java.io.ByteArrayOutputStream.size()
-		bos = new java.io.ByteArrayOutputStream();
-		bos.write(fileString.getBytes(), 0, 100);
-		assertEquals("size test failed", 100, bos.size());
-		bos.reset();
-		assertEquals("size test failed", 0, bos.size());
-	}
-
-	/**
-	 * @tests java.io.ByteArrayOutputStream#toByteArray()
-	 */
-	public void test_toByteArray() {
-		// Test for method byte [] java.io.ByteArrayOutputStream.toByteArray()
-		byte[] bytes;
-		byte[] sbytes = fileString.getBytes();
-		bos = new java.io.ByteArrayOutputStream();
-		bos.write(fileString.getBytes(), 0, fileString.length());
-		bytes = bos.toByteArray();
-		for (int i = 0; i < fileString.length(); i++) {
-			assertTrue("Error in byte array", bytes[i] == sbytes[i]);
-        }
-	}
+    /**
+     * @tests java.io.ByteArrayOutputStream#ByteArrayOutputStream(int)
+     */
+    public void test_ConstructorI() {
+        bos = new ByteArrayOutputStream(100);
+        assertEquals("Failed to create stream", 0, bos.size());
+    }
+
+    /**
+     * @tests java.io.ByteArrayOutputStream#ByteArrayOutputStream()
+     */
+    public void test_Constructor() {
+        bos = new ByteArrayOutputStream();
+        assertEquals("Failed to create stream", 0, bos.size());
+    }
 
-	/**
-	 * @tests java.io.ByteArrayOutputStream#toString(java.lang.String)
-	 */
-	public void test_toStringLjava_lang_String() throws Exception {
-        // Test for method java.lang.String
-        // java.io.ByteArrayOutputStream.toString(java.lang.String)
-        java.io.ByteArrayOutputStream bos;
+    /**
+     * @tests java.io.ByteArrayOutputStream#close()
+     */
+    public void test_close() {
+        // close() does nothing for this implementation of OutputSteam
+
+        // The spec seems to say that a closed output stream can't be written
+        // to. We don't throw an exception if attempt is made to write.
+        // Right now our implementation doesn't do anything testable but
+        // should we decide to throw an exception if a closed stream is
+        // written to, the appropriate test is commented out below.
+
+        /***********************************************************************
+         * java.io.ByteArrayOutputStream bos = new
+         * java.io.ByteArrayOutputStream(); bos.write (fileString.getBytes(), 0,
+         * 100); try { bos.close(); } catch (java.io.IOException e) {
+         * fail("IOException closing stream"); } try { bos.write
+         * (fileString.getBytes(), 0, 100); bos.toByteArray(); fail("Wrote to
+         * closed stream"); } catch (Exception e) { }
+         **********************************************************************/
+    }
+
+    /**
+     * @tests java.io.ByteArrayOutputStream#reset()
+     */
+    public void test_reset() {
         bos = new java.io.ByteArrayOutputStream();
+        bos.write(fileString.getBytes(), 0, 100);
+        bos.reset();
+        assertEquals("reset failed", 0, bos.size());
+    }
+
+    /**
+     * @tests java.io.ByteArrayOutputStream#size()
+     */
+    public void test_size() {
+        bos = new java.io.ByteArrayOutputStream();
+        bos.write(fileString.getBytes(), 0, 100);
+        assertEquals("size test failed", 100, bos.size());
+        bos.reset();
+        assertEquals("size test failed", 0, bos.size());
+    }
+
+    /**
+     * @tests java.io.ByteArrayOutputStream#toByteArray()
+     */
+    public void test_toByteArray() {
+        byte[] bytes;
+        byte[] sbytes = fileString.getBytes();
+        bos = new java.io.ByteArrayOutputStream();
+        bos.write(fileString.getBytes(), 0, fileString.length());
+        bytes = bos.toByteArray();
+        for (int i = 0; i < fileString.length(); i++) {
+            assertTrue("Error in byte array", bytes[i] == sbytes[i]);
+        }
+    }
+
+    /**
+     * @tests java.io.ByteArrayOutputStream#toString(java.lang.String)
+     */
+    public void test_toStringLjava_lang_String() throws IOException {
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
 
         bos.write(fileString.getBytes(), 0, fileString.length());
         assertTrue("Returned incorrect 8859-1 String", bos.toString("8859_1")
                 .equals(fileString));
 
-        bos = new java.io.ByteArrayOutputStream();
+        bos = new ByteArrayOutputStream();
         bos.write(fileString.getBytes(), 0, fileString.length());
         assertTrue("Returned incorrect 8859-2 String", bos.toString("8859_2")
                 .equals(fileString));
     }
 
-	/**
-	 * @tests java.io.ByteArrayOutputStream#toString()
-	 */
-	public void test_toString() {
-		// Test for method java.lang.String
-		// java.io.ByteArrayOutputStream.toString()
-		java.io.ByteArrayOutputStream bos = null;
-		bos = new java.io.ByteArrayOutputStream();
-		bos.write(fileString.getBytes(), 0, fileString.length());
-		assertTrue("Returned incorrect String", bos.toString().equals(
-				fileString));
-	}
-
-	/**
-	 * @tests java.io.ByteArrayOutputStream#toString(int)
-	 */
-	@SuppressWarnings("deprecation")
+    /**
+     * @tests java.io.ByteArrayOutputStream#toString()
+     */
+    public void test_toString() {
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        bos.write(fileString.getBytes(), 0, fileString.length());
+        assertTrue("Returned incorrect String", bos.toString().equals(
+                fileString));
+    }
+
+    /**
+     * @tests java.io.ByteArrayOutputStream#toString(int)
+     */
+    @SuppressWarnings("deprecation")
     public void test_toStringI() {
-		// Test for method java.lang.String
-		// java.io.ByteArrayOutputStream.toString(int)
-		java.io.ByteArrayOutputStream bos = null;
-		bos = new java.io.ByteArrayOutputStream();
-		bos.write(fileString.getBytes(), 0, fileString.length());
-		assertTrue("Returned incorrect String",
-				bos.toString(5).length() == fileString.length());
-	}
-
-	/**
-	 * @tests java.io.ByteArrayOutputStream#write(int)
-	 */
-	public void test_writeI() {
-		// Test for method void java.io.ByteArrayOutputStream.write(int)
-		bos = new java.io.ByteArrayOutputStream();
-		bos.write('t');
-		byte[] result = bos.toByteArray();
-		assertEquals("Wrote incorrect bytes",
-				"t", new String(result, 0, result.length));
-	}
-
-	/**
-	 * @tests java.io.ByteArrayOutputStream#write(byte[], int, int)
-	 */
-	public void test_write$BII() {
-		// Test for method void java.io.ByteArrayOutputStream.write(byte [],
-		// int, int)
-		java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream();
-		bos.write(fileString.getBytes(), 0, 100);
-		byte[] result = bos.toByteArray();
-		assertTrue("Wrote incorrect bytes",
-				new String(result, 0, result.length).equals(fileString
-						.substring(0, 100)));
-	}
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        bos.write(fileString.getBytes(), 0, fileString.length());
+        assertTrue("Returned incorrect String",
+                bos.toString(5).length() == fileString.length());
+    }
+
+    /**
+     * @tests java.io.ByteArrayOutputStream#write(int)
+     */
+    public void test_writeI() {
+        bos = new ByteArrayOutputStream();
+        bos.write('t');
+        byte[] result = bos.toByteArray();
+        assertEquals("Wrote incorrect bytes", "t", new String(result, 0,
+                result.length));
+    }
+
+    /**
+     * @tests java.io.ByteArrayOutputStream#write(byte[], int, int)
+     */
+    public void test_write$BII() {
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        bos.write(fileString.getBytes(), 0, 100);
+        byte[] result = bos.toByteArray();
+        assertTrue("Wrote incorrect bytes",
+                new String(result, 0, result.length).equals(fileString
+                        .substring(0, 100)));
+    }
 
     /**
      * @tests java.io.ByteArrayOutputStream#write(byte[], int, int)
      */
     public void test_write$BII_2() {
-        //Regression for HARMONY-387
+        // Regression for HARMONY-387
         ByteArrayOutputStream obj = new ByteArrayOutputStream();
         try {
-            obj.write(new byte [] {(byte)0x00}, -1, 0);
+            obj.write(new byte[] { (byte) 0x00 }, -1, 0);
             fail("IndexOutOfBoundsException expected");
         } catch (IndexOutOfBoundsException t) {
             assertEquals(
@@ -217,21 +196,20 @@
         }
     }
 
-	/**
-	 * @tests java.io.ByteArrayOutputStream#writeTo(java.io.OutputStream)
-	 */
-	public void test_writeToLjava_io_OutputStream() throws Exception {
-		// Test for method void
-		// java.io.ByteArrayOutputStream.writeTo(java.io.OutputStream)
-		java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream();
-		java.io.ByteArrayOutputStream bos2 = new java.io.ByteArrayOutputStream();
-		bos.write(fileString.getBytes(), 0, 100);
-		bos.writeTo(bos2);
-		assertTrue("Returned incorrect String", bos2.toString().equals(
-				fileString.substring(0, 100)));
-
-        //Regression test for HARMONY-834
-		//no exception expected
-		new ByteArrayOutputStream().writeTo(new FileOutputStream(new FileDescriptor()));
-	}
+    /**
+     * @tests java.io.ByteArrayOutputStream#writeTo(java.io.OutputStream)
+     */
+    public void test_writeToLjava_io_OutputStream() throws Exception {
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        ByteArrayOutputStream bos2 = new ByteArrayOutputStream();
+        bos.write(fileString.getBytes(), 0, 100);
+        bos.writeTo(bos2);
+        assertTrue("Returned incorrect String", bos2.toString().equals(
+                fileString.substring(0, 100)));
+
+        // Regression test for HARMONY-834
+        // no exception expected
+        new ByteArrayOutputStream().writeTo(new FileOutputStream(
+                new FileDescriptor()));
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/CharArrayWriterTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/CharArrayWriterTest.java?rev=612569&r1=612568&r2=612569&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/CharArrayWriterTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/CharArrayWriterTest.java Wed Jan 16 12:56:03 2008
@@ -34,7 +34,6 @@
      * @tests java.io.CharArrayWriter#CharArrayWriter()
      */
     public void test_Constructor() {
-        // Test for method java.io.CharArrayWriter()
         cw = new CharArrayWriter(90);
         assertEquals("Created incorrect writer", 0, cw.size());
     }
@@ -43,7 +42,6 @@
      * @tests java.io.CharArrayWriter#CharArrayWriter(int)
      */
     public void test_ConstructorI() {
-        // Test for method java.io.CharArrayWriter(int)
         cw = new CharArrayWriter();
         assertEquals("Created incorrect writer", 0, cw.size());
     }
@@ -52,7 +50,6 @@
      * @tests java.io.CharArrayWriter#close()
      */
     public void test_close() {
-        // Test for method void java.io.CharArrayWriter.close()
         cw.close();
     }
 
@@ -60,34 +57,27 @@
      * @tests java.io.CharArrayWriter#flush()
      */
     public void test_flush() {
-        // Test for method void java.io.CharArrayWriter.flush()
         cw.flush();
     }
 
     /**
      * @tests java.io.CharArrayWriter#reset()
      */
-    public void test_reset() {
-        // Test for method void java.io.CharArrayWriter.reset()
+    public void test_reset() throws IOException {
         cw.write("HelloWorld", 5, 5);
         cw.reset();
         cw.write("HelloWorld", 0, 5);
         cr = new CharArrayReader(cw.toCharArray());
-        try {
-            char[] c = new char[100];
-            cr.read(c, 0, 5);
-            assertEquals("Reset failed to reset buffer",
-                         "Hello", new String(c, 0, 5));
-        } catch (IOException e) {
-            fail("Exception during reset test : " + e.getMessage());
-        }
+        char[] c = new char[100];
+        cr.read(c, 0, 5);
+        assertEquals("Reset failed to reset buffer", "Hello", new String(c, 0,
+                5));
     }
 
     /**
      * @tests java.io.CharArrayWriter#size()
      */
     public void test_size() {
-        // Test for method int java.io.CharArrayWriter.size()
         assertEquals("Returned incorrect size", 0, cw.size());
         cw.write(hw, 5, 5);
         assertEquals("Returned incorrect size", 5, cw.size());
@@ -96,56 +86,44 @@
     /**
      * @tests java.io.CharArrayWriter#toCharArray()
      */
-    public void test_toCharArray() {
-        // Test for method char [] java.io.CharArrayWriter.toCharArray()
+    public void test_toCharArray() throws IOException {
         cw.write("HelloWorld", 0, 10);
         cr = new CharArrayReader(cw.toCharArray());
-        try {
-            char[] c = new char[100];
-            cr.read(c, 0, 10);
-            assertEquals("toCharArray failed to return correct array",
-                         "HelloWorld", new String(c, 0, 10));
-        } catch (IOException e) {
-            fail("Exception during toCharArray test : " + e.getMessage());
-        }
+        char[] c = new char[100];
+        cr.read(c, 0, 10);
+        assertEquals("toCharArray failed to return correct array",
+                "HelloWorld", new String(c, 0, 10));
     }
 
     /**
      * @tests java.io.CharArrayWriter#toString()
      */
     public void test_toString() {
-        // Test for method java.lang.String java.io.CharArrayWriter.toString()
         cw.write("HelloWorld", 5, 5);
         cr = new CharArrayReader(cw.toCharArray());
-        assertEquals("Returned incorrect string",
-                     "World", cw.toString());
+        assertEquals("Returned incorrect string", "World", cw.toString());
     }
 
     /**
      * @tests java.io.CharArrayWriter#write(char[], int, int)
      */
-    public void test_write$CII() {
-        // Test for method void java.io.CharArrayWriter.write(char [], int, int)
+    public void test_write$CII() throws IOException {
         cw.write(hw, 5, 5);
         cr = new CharArrayReader(cw.toCharArray());
-        try {
-            char[] c = new char[100];
-            cr.read(c, 0, 5);
-            assertEquals("Writer failed to write correct chars",
-                         "World", new String(c, 0, 5));
-        } catch (IOException e) {
-            fail("Exception during write test : " + e.getMessage());
-        }
+        char[] c = new char[100];
+        cr.read(c, 0, 5);
+        assertEquals("Writer failed to write correct chars", "World",
+                new String(c, 0, 5));
     }
 
     /**
      * @tests java.io.CharArrayWriter#write(char[], int, int)
-     * Regression for HARMONY-387
      */
     public void test_write$CII_2() {
+        // Regression for HARMONY-387
         CharArrayWriter obj = new CharArrayWriter();
         try {
-            obj.write(new char []{'0'}, 0, -1);
+            obj.write(new char[] { '0' }, 0, -1);
             fail("IndexOutOfBoundsException expected");
         } catch (IndexOutOfBoundsException t) {
             assertEquals(
@@ -157,62 +135,48 @@
     /**
      * @tests java.io.CharArrayWriter#write(int)
      */
-    public void test_writeI() {
-        // Test for method void java.io.CharArrayWriter.write(int)
+    public void test_writeI() throws IOException {
         cw.write('T');
         cr = new CharArrayReader(cw.toCharArray());
-        try {
-            assertEquals("Writer failed to write char", 'T', cr.read());
-        } catch (IOException e) {
-            fail("Exception during write test : " + e.getMessage());
-        }
+        assertEquals("Writer failed to write char", 'T', cr.read());
     }
 
     /**
      * @tests java.io.CharArrayWriter#write(java.lang.String, int, int)
      */
-    public void test_writeLjava_lang_StringII() {
-        // Test for method void java.io.CharArrayWriter.write(java.lang.String,
-        // int, int)
+    public void test_writeLjava_lang_StringII() throws IOException {
         cw.write("HelloWorld", 5, 5);
         cr = new CharArrayReader(cw.toCharArray());
-        try {
-            char[] c = new char[100];
-            cr.read(c, 0, 5);
-            assertEquals("Writer failed to write correct chars",
-                         "World", new String(c, 0, 5));
-        } catch (IOException e) {
-            fail("Exception during write test : " + e.getMessage());
-        }
+        char[] c = new char[100];
+        cr.read(c, 0, 5);
+        assertEquals("Writer failed to write correct chars", "World",
+                new String(c, 0, 5));
     }
 
     /**
      * @tests java.io.CharArrayWriter#write(java.lang.String, int, int)
-     * Regression for HARMONY-387
      */
-    public void test_writeLjava_lang_StringII_2() throws StringIndexOutOfBoundsException {
+    public void test_writeLjava_lang_StringII_2()
+            throws StringIndexOutOfBoundsException {
+        // Regression for HARMONY-387
         CharArrayWriter obj = new CharArrayWriter();
         try {
             obj.write((String) null, -1, 0);
             fail("NullPointerException expected");
         } catch (NullPointerException t) {
+            // Expected
         }
     }
 
     /**
      * @tests java.io.CharArrayWriter#writeTo(java.io.Writer)
      */
-    public void test_writeToLjava_io_Writer() {
-        // Test for method void java.io.CharArrayWriter.writeTo(java.io.Writer)
+    public void test_writeToLjava_io_Writer() throws IOException {
         cw.write("HelloWorld", 0, 10);
         StringWriter sw = new StringWriter();
-        try {
-            cw.writeTo(sw);
-            assertEquals("Writer failed to write correct chars",
-                         "HelloWorld", sw.toString());
-        } catch (IOException e) {
-            fail("Exception during writeTo test : " + e.getMessage());
-        }
+        cw.writeTo(sw);
+        assertEquals("Writer failed to write correct chars", "HelloWorld", sw
+                .toString());
     }
 
     /**
@@ -228,8 +192,9 @@
      * method is called after a test is executed.
      */
     protected void tearDown() {
-        if (cr != null)
+        if (cr != null) {
             cr.close();
+        }
         cw.close();
     }
 
@@ -249,7 +214,6 @@
      * @tests java.io.CharArrayWriter#append(CharSequence)
      */
     public void test_appendCharSequence() {
-
         String testString = "My Test String";
         CharArrayWriter writer = new CharArrayWriter(10);
         writer.append(testString);
@@ -268,7 +232,5 @@
         writer.flush();
         assertEquals(testString.substring(1, 3), writer.toString());
         writer.close();
-
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/CharConversionExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/CharConversionExceptionTest.java?rev=612569&r1=612568&r2=612569&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/CharConversionExceptionTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/CharConversionExceptionTest.java Wed Jan 16 12:56:03 2008
@@ -17,52 +17,39 @@
 
 package org.apache.harmony.luni.tests.java.io;
 
-public class CharConversionExceptionTest extends junit.framework.TestCase {
-
-	/**
-	 * @tests java.io.CharConversionException#CharConversionException()
-	 */
-	public void test_Constructor() {
-		// Test for method java.io.CharConversionException()
-		// Currently, there are no refs to CharConversionException so this is
-		// the best test we can do
-		try {
-			if (true) // BB: getting around LF
-				throw new java.io.CharConversionException();
-			fail("Exception not thrown");
-		} catch (java.io.CharConversionException e) {
-			assertNull(
-					"Exception defined with no message answers non-null to getMessage()",
-					e.getMessage());
-		}
-	}
+import java.io.CharConversionException;
 
-	/**
-	 * @tests java.io.CharConversionException#CharConversionException(java.lang.String)
-	 */
-	public void test_ConstructorLjava_lang_String() {
-		// Test for method java.io.CharConversionException(java.lang.String)
-		try {
-			if (true) // getting around LF
-				throw new java.io.CharConversionException("Blah");
-			fail("Exception not thrown");
-		} catch (java.io.CharConversionException e) {
-			assertEquals("Exception defined with no message answers non-null to getMessage()",
-					"Blah", e.getMessage());
-		}
-	}
+public class CharConversionExceptionTest extends junit.framework.TestCase {
 
-	/**
-	 * Sets up the fixture, for example, open a network connection. This method
-	 * is called before a test is executed.
-	 */
-	protected void setUp() {
-	}
+    /**
+     * @tests java.io.CharConversionException#CharConversionException()
+     */
+    public void test_Constructor() {
+        // Currently, there are no refs to CharConversionException so this is
+        // the best test we can do
+        try {
+            if (true) // BB: getting around LF
+                throw new CharConversionException();
+            fail("Exception not thrown");
+        } catch (CharConversionException e) {
+            assertNull(
+                    "Exception defined with no message answers non-null to getMessage()",
+                    e.getMessage());
+        }
+    }
 
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
-	}
+    /**
+     * @tests java.io.CharConversionException#CharConversionException(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        try {
+            if (true) // getting around LF
+                throw new CharConversionException("Blah");
+            fail("Exception not thrown");
+        } catch (CharConversionException e) {
+            assertEquals(
+                    "Exception defined with no message answers non-null to getMessage()",
+                    "Blah", e.getMessage());
+        }
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/DataInputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/DataInputStreamTest.java?rev=612569&r1=612568&r2=612569&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/DataInputStreamTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/DataInputStreamTest.java Wed Jan 16 12:56:03 2008
@@ -26,207 +26,155 @@
 
 public class DataInputStreamTest extends junit.framework.TestCase {
 
-	private DataOutputStream os;
+    private DataOutputStream os;
 
-	private DataInputStream dis;
+    private DataInputStream dis;
 
-	private ByteArrayOutputStream bos;
+    private ByteArrayOutputStream bos;
 
-	String unihw = "\u0048\u0065\u006C\u006C\u006F\u0020\u0057\u006F\u0072\u006C\u0064";
+    String unihw = "\u0048\u0065\u006C\u006C\u006F\u0020\u0057\u006F\u0072\u006C\u0064";
+
+    public String fileString = "Test_All_Tests\nTest_java_io_BufferedInputStream\nTest_java_io_BufferedOutputStream\nTest_java_io_ByteArrayInputStream\nTest_java_io_ByteArrayOutputStream\nTest_DataInputStream\n";
+
+    /**
+     * @tests java.io.DataInputStream#DataInputStream(java.io.InputStream)
+     */
+    public void test_ConstructorLjava_io_InputStream() throws IOException {
+        try {
+            os.writeChar('t');
+            os.close();
+            openDataInputStream();
+        } finally {
+            dis.close();
+        }
+    }
+
+    /**
+     * @tests java.io.DataInputStream#read(byte[])
+     */
+    public void test_read$B() throws IOException {
+        os.write(fileString.getBytes());
+        os.close();
+        openDataInputStream();
+        byte rbytes[] = new byte[fileString.length()];
+        dis.read(rbytes);
+        assertTrue("Incorrect data read", new String(rbytes, 0, fileString
+                .length()).equals(fileString));
+    }
+
+    /**
+     * @tests java.io.DataInputStream#read(byte[], int, int)
+     */
+    public void test_read$BII() throws IOException {
+        os.write(fileString.getBytes());
+        os.close();
+        openDataInputStream();
+        byte rbytes[] = new byte[fileString.length()];
+        dis.read(rbytes, 0, rbytes.length);
+        assertTrue("Incorrect data read", new String(rbytes, 0, fileString
+                .length()).equals(fileString));
+    }
+
+    /**
+     * @tests java.io.DataInputStream#readBoolean()
+     */
+    public void test_readBoolean() throws IOException {
+        os.writeBoolean(true);
+        os.close();
+        openDataInputStream();
+        assertTrue("Incorrect boolean written", dis.readBoolean());
+    }
+
+    /**
+     * @tests java.io.DataInputStream#readByte()
+     */
+    public void test_readByte() throws IOException {
+        os.writeByte((byte) 127);
+        os.close();
+        openDataInputStream();
+        assertTrue("Incorrect byte read", dis.readByte() == (byte) 127);
+    }
+
+    /**
+     * @tests java.io.DataInputStream#readChar()
+     */
+    public void test_readChar() throws IOException {
+        os.writeChar('t');
+        os.close();
+        openDataInputStream();
+        assertEquals("Incorrect char read", 't', dis.readChar());
+    }
+
+    /**
+     * @tests java.io.DataInputStream#readDouble()
+     */
+    public void test_readDouble() throws IOException {
+        os.writeDouble(2345.76834720202);
+        os.close();
+        openDataInputStream();
+        assertEquals("Incorrect double read", 2345.76834720202, dis
+                .readDouble());
+    }
+
+    /**
+     * @tests java.io.DataInputStream#readFloat()
+     */
+    public void test_readFloat() throws IOException {
+        os.writeFloat(29.08764f);
+        os.close();
+        openDataInputStream();
+        assertTrue("Incorrect float read", dis.readFloat() == 29.08764f);
+    }
+
+    /**
+     * @tests java.io.DataInputStream#readFully(byte[])
+     */
+    public void test_readFully$B() throws IOException {
+        os.write(fileString.getBytes());
+        os.close();
+        openDataInputStream();
+        byte rbytes[] = new byte[fileString.length()];
+        dis.readFully(rbytes);
+        assertTrue("Incorrect data read", new String(rbytes, 0, fileString
+                .length()).equals(fileString));
+    }
+
+    /**
+     * @tests java.io.DataInputStream#readFully(byte[], int, int)
+     */
+    public void test_readFully$BII() throws IOException {
+        os.write(fileString.getBytes());
+        os.close();
+        openDataInputStream();
+        byte rbytes[] = new byte[fileString.length()];
+        dis.readFully(rbytes, 0, fileString.length());
+        assertTrue("Incorrect data read", new String(rbytes, 0, fileString
+                .length()).equals(fileString));
+    }
 
-	public String fileString = "Test_All_Tests\nTest_java_io_BufferedInputStream\nTest_java_io_BufferedOutputStream\nTest_java_io_ByteArrayInputStream\nTest_java_io_ByteArrayOutputStream\nTest_DataInputStream\n";
-
-	/**
-	 * @tests java.io.DataInputStream#DataInputStream(java.io.InputStream)
-	 */
-	public void test_ConstructorLjava_io_InputStream() {
-		// Test for method java.io.DataInputStream(java.io.InputStream)
-		try {
-			os.writeChar('t');
-			os.close();
-			openDataInputStream();
-		} catch (IOException e) {
-			fail("IOException during constructor test : " + e.getMessage());
-		} finally {
-			try {
-				dis.close();
-			} catch (IOException e) {
-				fail("IOException during constructor test : " + e.getMessage());
-			}
-		}
-	}
-
-	/**
-	 * @tests java.io.DataInputStream#read(byte[])
-	 */
-	public void test_read$B() {
-		// Test for method int java.io.DataInputStream.read(byte [])
-		try {
-			os.write(fileString.getBytes());
-			os.close();
-			openDataInputStream();
-			byte rbytes[] = new byte[fileString.length()];
-			dis.read(rbytes);
-			assertTrue("Incorrect data read", new String(rbytes, 0, fileString
-					.length()).equals(fileString));
-		} catch (IOException e) {
-			fail("IOException during read test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataInputStream#read(byte[], int, int)
-	 */
-	public void test_read$BII() {
-		// Test for method int java.io.DataInputStream.read(byte [], int, int)
-		try {
-			os.write(fileString.getBytes());
-			os.close();
-			openDataInputStream();
-			byte rbytes[] = new byte[fileString.length()];
-			dis.read(rbytes, 0, rbytes.length);
-			assertTrue("Incorrect data read", new String(rbytes, 0, fileString
-					.length()).equals(fileString));
-		} catch (IOException e) {
-			fail("IOException during read test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataInputStream#readBoolean()
-	 */
-	public void test_readBoolean() {
-		// Test for method boolean java.io.DataInputStream.readBoolean()
-		try {
-			os.writeBoolean(true);
-			os.close();
-			openDataInputStream();
-			assertTrue("Incorrect boolean written", dis.readBoolean());
-		} catch (IOException e) {
-			fail("readBoolean test failed : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataInputStream#readByte()
-	 */
-	public void test_readByte() {
-		// Test for method byte java.io.DataInputStream.readByte()
-		try {
-			os.writeByte((byte) 127);
-			os.close();
-			openDataInputStream();
-			assertTrue("Incorrect byte read", dis.readByte() == (byte) 127);
-		} catch (IOException e) {
-			fail("IOException during readByte test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataInputStream#readChar()
-	 */
-	public void test_readChar() {
-		// Test for method char java.io.DataInputStream.readChar()
-		try {
-			os.writeChar('t');
-			os.close();
-			openDataInputStream();
-			assertEquals("Incorrect char read", 't', dis.readChar());
-		} catch (IOException e) {
-			fail("IOException during readChar test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataInputStream#readDouble()
-	 */
-	public void test_readDouble() {
-		// Test for method double java.io.DataInputStream.readDouble()
-		try {
-			os.writeDouble(2345.76834720202);
-			os.close();
-			openDataInputStream();
-			assertEquals("Incorrect double read",
-					2345.76834720202, dis.readDouble());
-		} catch (IOException e) {
-			fail("IOException during readDouble test" + e.toString());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataInputStream#readFloat()
-	 */
-	public void test_readFloat() {
-		// Test for method float java.io.DataInputStream.readFloat()
-		try {
-			os.writeFloat(29.08764f);
-			os.close();
-			openDataInputStream();
-			assertTrue("Incorrect float read", dis.readFloat() == 29.08764f);
-		} catch (IOException e) {
-			fail("readFloat test failed : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataInputStream#readFully(byte[])
-	 */
-	public void test_readFully$B() {
-		// Test for method void java.io.DataInputStream.readFully(byte [])
-		try {
-			os.write(fileString.getBytes());
-			os.close();
-			openDataInputStream();
-			byte rbytes[] = new byte[fileString.length()];
-			dis.readFully(rbytes);
-			assertTrue("Incorrect data read", new String(rbytes, 0, fileString
-					.length()).equals(fileString));
-		} catch (IOException e) {
-			fail("IOException during readFully test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataInputStream#readFully(byte[], int, int)
-	 */
-	public void test_readFully$BII() {
-		// Test for method void java.io.DataInputStream.readFully(byte [], int,
-		// int)
-		try {
-			os.write(fileString.getBytes());
-			os.close();
-			openDataInputStream();
-			byte rbytes[] = new byte[fileString.length()];
-			dis.readFully(rbytes, 0, fileString.length());
-			assertTrue("Incorrect data read", new String(rbytes, 0, fileString
-					.length()).equals(fileString));
-		} catch (IOException e) {
-			fail("IOException during readFully test : " + e.getMessage());
-		}
-	}
-    
     /**
      * @tests java.io.DataInputStream#readFully(byte[], int, int)
      */
     public void test_readFully$BII_Exception() throws IOException {
-        DataInputStream is =  new DataInputStream(new ByteArrayInputStream(new byte[fileString.length()]));
+        DataInputStream is = new DataInputStream(new ByteArrayInputStream(
+                new byte[fileString.length()]));
+
+        byte[] byteArray = new byte[fileString.length()];
 
-        byte[] byteArray = new byte[fileString.length()]; 
-        
         try {
             is.readFully(byteArray, -1, -1);
             fail("should throw IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException e) {
             // expected
         }
-        
+
         try {
             is.readFully(byteArray, 0, -1);
             fail("should throw IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException e) {
             // expected
         }
-        
+
         try {
             is.readFully(byteArray, 1, -1);
             fail("should throw IndexOutOfBoundsException");
@@ -237,14 +185,14 @@
         is.readFully(byteArray, -1, 0);
         is.readFully(byteArray, 0, 0);
         is.readFully(byteArray, 1, 0);
-        
+
         try {
             is.readFully(byteArray, -1, 1);
             fail("should throw IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException e) {
             // expected
         }
-        
+
         is.readFully(byteArray, 0, 1);
         is.readFully(byteArray, 1, 1);
         try {
@@ -254,29 +202,30 @@
             // expected
         }
     }
-    
+
     /**
      * @tests java.io.DataInputStream#readFully(byte[], int, int)
      */
     public void test_readFully$BII_NullArray() throws IOException {
-        DataInputStream is =  new DataInputStream(new ByteArrayInputStream(new byte[fileString.length()]));
-        
+        DataInputStream is = new DataInputStream(new ByteArrayInputStream(
+                new byte[fileString.length()]));
+
         byte[] nullByteArray = null;
-       
+
         try {
             is.readFully(nullByteArray, -1, -1);
             fail("should throw IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException e) {
             // expected
         }
-        
+
         try {
             is.readFully(nullByteArray, 0, -1);
             fail("should throw IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException e) {
             // expected
         }
-        
+
         try {
             is.readFully(nullByteArray, 1, -1);
             fail("should throw IndexOutOfBoundsException");
@@ -287,14 +236,14 @@
         is.readFully(nullByteArray, -1, 0);
         is.readFully(nullByteArray, 0, 0);
         is.readFully(nullByteArray, 1, 0);
-        
+
         try {
             is.readFully(nullByteArray, -1, 1);
             fail("should throw NullPointerException");
         } catch (NullPointerException e) {
             // expected
         }
-        
+
         try {
             is.readFully(nullByteArray, 0, 1);
             fail("should throw NullPointerException");
@@ -308,7 +257,7 @@
         } catch (NullPointerException e) {
             // expected
         }
-        
+
         try {
             is.readFully(nullByteArray, 0, Integer.MAX_VALUE);
             fail("should throw NullPointerException");
@@ -316,28 +265,28 @@
             // expected
         }
     }
-    
+
     /**
      * @tests java.io.DataInputStream#readFully(byte[], int, int)
      */
     public void test_readFully$BII_NullStream() throws IOException {
         DataInputStream is = new DataInputStream(null);
-        byte[] byteArray = new byte[fileString.length()]; 
-           
+        byte[] byteArray = new byte[fileString.length()];
+
         try {
             is.readFully(byteArray, -1, -1);
             fail("should throw IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException e) {
             // expected
         }
-        
+
         try {
             is.readFully(byteArray, 0, -1);
             fail("should throw IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException e) {
             // expected
         }
-        
+
         try {
             is.readFully(byteArray, 1, -1);
             fail("should throw IndexOutOfBoundsException");
@@ -348,14 +297,14 @@
         is.readFully(byteArray, -1, 0);
         is.readFully(byteArray, 0, 0);
         is.readFully(byteArray, 1, 0);
-        
+
         try {
             is.readFully(byteArray, -1, 1);
             fail("should throw NullPointerException");
         } catch (NullPointerException e) {
             // expected
         }
-        
+
         try {
             is.readFully(byteArray, 0, 1);
             fail("should throw NullPointerException");
@@ -369,7 +318,7 @@
         } catch (NullPointerException e) {
             // expected
         }
-        
+
         try {
             is.readFully(byteArray, 0, Integer.MAX_VALUE);
             fail("should throw NullPointerException");
@@ -377,28 +326,28 @@
             // expected
         }
     }
-    
+
     /**
      * @tests java.io.DataInputStream#readFully(byte[], int, int)
      */
     public void test_readFully$BII_NullStream_NullArray() throws IOException {
         DataInputStream is = new DataInputStream(null);
         byte[] nullByteArray = null;
-        
+
         try {
             is.readFully(nullByteArray, -1, -1);
             fail("should throw IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException e) {
             // expected
         }
-        
+
         try {
             is.readFully(nullByteArray, 0, -1);
             fail("should throw IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException e) {
             // expected
         }
-        
+
         try {
             is.readFully(nullByteArray, 1, -1);
             fail("should throw IndexOutOfBoundsException");
@@ -409,14 +358,14 @@
         is.readFully(nullByteArray, -1, 0);
         is.readFully(nullByteArray, 0, 0);
         is.readFully(nullByteArray, 1, 0);
-        
+
         try {
             is.readFully(nullByteArray, -1, 1);
             fail("should throw NullPointerException");
         } catch (NullPointerException e) {
             // expected
         }
-        
+
         try {
             is.readFully(nullByteArray, 0, 1);
             fail("should throw NullPointerException");
@@ -430,116 +379,88 @@
         } catch (NullPointerException e) {
             // expected
         }
-        
+
         try {
             is.readFully(nullByteArray, 0, Integer.MAX_VALUE);
             fail("should throw NullPointerException");
         } catch (NullPointerException e) {
             // expected
         }
-        
     }
 
-	/**
-	 * @tests java.io.DataInputStream#readInt()
-	 */
-	public void test_readInt() {
-		// Test for method int java.io.DataInputStream.readInt()
-		try {
-			os.writeInt(768347202);
-			os.close();
-			openDataInputStream();
-			assertEquals("Incorrect int read", 768347202, dis.readInt());
-		} catch (IOException e) {
-			fail("IOException during readInt test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataInputStream#readLine()
-	 */
-	@SuppressWarnings("deprecation")
-    public void test_readLine() {
-		// Test for method java.lang.String java.io.DataInputStream.readLine()
-		try {
-			os.writeBytes("Hello");
-			os.close();
-			openDataInputStream();
-			String line = dis.readLine();
-			assertTrue("Incorrect line read: " + line, line.equals("Hello"));
-		} catch (IOException e) {
-			fail("IOException during readLine test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataInputStream#readLong()
-	 */
-	public void test_readLong() {
-		// Test for method long java.io.DataInputStream.readLong()
-		try {
-			os.writeLong(9875645283333L);
-			os.close();
-			openDataInputStream();
-			assertEquals("Incorrect long read", 9875645283333L, dis.readLong());
-		} catch (IOException e) {
-			fail("read long test failed : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataInputStream#readShort()
-	 */
-	public void test_readShort() {
-		// Test for method short java.io.DataInputStream.readShort()
-		try {
-			os.writeShort(9875);
-			os.close();
-			openDataInputStream();
-			assertTrue("Incorrect short read", dis.readShort() == (short) 9875);
-		} catch (IOException e) {
-			fail("Exception during read short test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataInputStream#readUnsignedByte()
-	 */
-	public void test_readUnsignedByte() {
-		// Test for method int java.io.DataInputStream.readUnsignedByte()
-		try {
-			os.writeByte((byte) -127);
-			os.close();
-			openDataInputStream();
-			assertEquals("Incorrect byte read", 129, dis.readUnsignedByte());
-		} catch (IOException e) {
-			fail("IOException during readUnsignedByte test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataInputStream#readUnsignedShort()
-	 */
-	public void test_readUnsignedShort() throws Exception {
-		// Test for method int java.io.DataInputStream.readUnsignedShort()
-		os.writeShort(9875);
-		os.close();
-		openDataInputStream();
-		assertEquals("Incorrect short read", 9875, dis.readUnsignedShort());
-	}
-
-	/**
-	 * @tests java.io.DataInputStream#readUTF()
-	 */
-	public void test_readUTF() throws Exception {
-		// Test for method java.lang.String java.io.DataInputStream.readUTF()
-                os.writeUTF(unihw);
-                os.close();
-                openDataInputStream();
-                assertTrue("Failed to write string in UTF format",
-                                dis.available() == unihw.length() + 2);
-                assertTrue("Incorrect string read", dis.readUTF().equals(unihw));
-	}
+    /**
+     * @tests java.io.DataInputStream#readInt()
+     */
+    public void test_readInt() throws IOException {
+        os.writeInt(768347202);
+        os.close();
+        openDataInputStream();
+        assertEquals("Incorrect int read", 768347202, dis.readInt());
+    }
+
+    /**
+     * @tests java.io.DataInputStream#readLine()
+     */
+    @SuppressWarnings("deprecation")
+    public void test_readLine() throws IOException {
+        os.writeBytes("Hello");
+        os.close();
+        openDataInputStream();
+        String line = dis.readLine();
+        assertTrue("Incorrect line read: " + line, line.equals("Hello"));
+    }
+
+    /**
+     * @tests java.io.DataInputStream#readLong()
+     */
+    public void test_readLong() throws IOException {
+        os.writeLong(9875645283333L);
+        os.close();
+        openDataInputStream();
+        assertEquals("Incorrect long read", 9875645283333L, dis.readLong());
+    }
+
+    /**
+     * @tests java.io.DataInputStream#readShort()
+     */
+    public void test_readShort() throws IOException {
+        os.writeShort(9875);
+        os.close();
+        openDataInputStream();
+        assertTrue("Incorrect short read", dis.readShort() == (short) 9875);
+    }
+
+    /**
+     * @tests java.io.DataInputStream#readUnsignedByte()
+     */
+    public void test_readUnsignedByte() throws IOException {
+        os.writeByte((byte) -127);
+        os.close();
+        openDataInputStream();
+        assertEquals("Incorrect byte read", 129, dis.readUnsignedByte());
+    }
+
+    /**
+     * @tests java.io.DataInputStream#readUnsignedShort()
+     */
+    public void test_readUnsignedShort() throws IOException {
+        os.writeShort(9875);
+        os.close();
+        openDataInputStream();
+        assertEquals("Incorrect short read", 9875, dis.readUnsignedShort());
+    }
+
+    /**
+     * @tests java.io.DataInputStream#readUTF()
+     */
+    public void test_readUTF() throws IOException {
+        os.writeUTF(unihw);
+        os.close();
+        openDataInputStream();
+        assertTrue("Failed to write string in UTF format",
+                dis.available() == unihw.length() + 2);
+        assertTrue("Incorrect string read", dis.readUTF().equals(unihw));
+    }
 
     static class TestDataInputStream implements DataInput {
         public boolean readBoolean() throws IOException {
@@ -566,7 +487,7 @@
         }
 
         public void readFully(byte[] buffer, int offset, int count)
-            throws IOException {
+                throws IOException {
         }
 
         public int readInt() throws IOException {
@@ -602,85 +523,72 @@
         }
     }
 
-	/**
-	 * @tests java.io.DataInputStream#readUTF(java.io.DataInput)
-	 */
-	public void test_readUTFLjava_io_DataInput() throws Exception {
-		// Test for method java.lang.String
-		// java.io.DataInputStream.readUTF(java.io.DataInput)
-                os.writeUTF(unihw);
-                os.close();
-                openDataInputStream();
-                assertTrue("Failed to write string in UTF format",
-                                dis.available() == unihw.length() + 2);
-                assertTrue("Incorrect string read", DataInputStream.readUTF(dis)
-                                .equals(unihw));
-
-                // Regression test for HARMONY-5336
-                new TestDataInputStream().readUTF();
-	}
-
-	/**
-	 * @tests java.io.DataInputStream#skipBytes(int)
-	 */
-	public void test_skipBytesI() {
-		// Test for method int java.io.DataInputStream.skipBytes(int)
-		try {
-			byte fileBytes[] = fileString.getBytes();
-			os.write(fileBytes);
-			os.close();
-			openDataInputStream();
-			dis.skipBytes(100);
-			byte rbytes[] = new byte[fileString.length()];
-			dis.read(rbytes, 0, 50);
-			dis.close();
-			assertTrue("Incorrect data read", new String(rbytes, 0, 50)
-					.equals(fileString.substring(100, 150)));
-		} catch (IOException e) {
-			fail("IOException during skipBytes test 1 : " + e.getMessage());
-		}
-		try {
-			// boolean eofException = false; //what is this var for?
-			int skipped = 0;
-			openDataInputStream();
-			try {
-				skipped = dis.skipBytes(50000);
-			} catch (EOFException e) {
-				// eofException = true;
-			}
-			;
-			assertTrue("Skipped should report " + fileString.length() + " not "
-					+ skipped, skipped == fileString.length());
-		} catch (IOException e) {
-			fail("IOException during skipBytes test 2 : " + e.getMessage());
-		}
-	}
-
-	private void openDataInputStream() throws IOException {
-		dis = new DataInputStream(new ByteArrayInputStream(bos.toByteArray()));
-	}
-
-	/**
-	 * Sets up the fixture, for example, open a network connection. This method
-	 * is called before a test is executed.
-	 */
-	protected void setUp() {
-		bos = new ByteArrayOutputStream();
-		os = new DataOutputStream(bos);
-	}
-
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
-		try {
-			os.close();
-		} catch (Exception e) {
-		}
+    /**
+     * @tests java.io.DataInputStream#readUTF(java.io.DataInput)
+     */
+    public void test_readUTFLjava_io_DataInput() throws IOException {
+        os.writeUTF(unihw);
+        os.close();
+        openDataInputStream();
+        assertTrue("Failed to write string in UTF format",
+                dis.available() == unihw.length() + 2);
+        assertTrue("Incorrect string read", DataInputStream.readUTF(dis)
+                .equals(unihw));
+
+        // Regression test for HARMONY-5336
+        new TestDataInputStream().readUTF();
+    }
+
+    /**
+     * @tests java.io.DataInputStream#skipBytes(int)
+     */
+    public void test_skipBytesI() throws IOException {
+        byte fileBytes[] = fileString.getBytes();
+        os.write(fileBytes);
+        os.close();
+        openDataInputStream();
+        dis.skipBytes(100);
+        byte rbytes[] = new byte[fileString.length()];
+        dis.read(rbytes, 0, 50);
+        dis.close();
+        assertTrue("Incorrect data read", new String(rbytes, 0, 50)
+                .equals(fileString.substring(100, 150)));
+
+        int skipped = 0;
+        openDataInputStream();
+        try {
+            skipped = dis.skipBytes(50000);
+        } catch (EOFException e) {
+        }
+        assertTrue("Skipped should report " + fileString.length() + " not "
+                + skipped, skipped == fileString.length());
+    }
+
+    private void openDataInputStream() throws IOException {
+        dis = new DataInputStream(new ByteArrayInputStream(bos.toByteArray()));
+    }
+
+    /**
+     * Sets up the fixture, for example, open a network connection. This method
+     * is called before a test is executed.
+     */
+    protected void setUp() {
+        bos = new ByteArrayOutputStream();
+        os = new DataOutputStream(bos);
+    }
+
+    /**
+     * Tears down the fixture, for example, close a network connection. This
+     * method is called after a test is executed.
+     */
+    protected void tearDown() {
+        try {
+            os.close();
+        } catch (Exception e) {
+        }
         try {
             dis.close();
         } catch (Exception e) {
         }
-	}
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/DataOutputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/DataOutputStreamTest.java?rev=612569&r1=612568&r2=612569&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/DataOutputStreamTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/DataOutputStreamTest.java Wed Jan 16 12:56:03 2008
@@ -25,314 +25,238 @@
 
 public class DataOutputStreamTest extends junit.framework.TestCase {
 
-	private DataOutputStream os;
+    private DataOutputStream os;
 
-	private DataInputStream dis;
+    private DataInputStream dis;
 
-	private ByteArrayOutputStream bos;
+    private ByteArrayOutputStream bos;
 
-	String unihw = "\u0048\u0065\u006C\u006C\u006F\u0020\u0057\u006F\u0072\u006C\u0064";
+    String unihw = "\u0048\u0065\u006C\u006C\u006F\u0020\u0057\u006F\u0072\u006C\u0064";
 
-	public String fileString = "Test_All_Tests\nTest_java_io_BufferedInputStream\nTest_java_io_BufferedOutputStream\nTest_java_io_ByteArrayInputStream\nTest_java_io_ByteArrayOutputStream\nTest_java_io_DataInputStream\n";
-
-	/**
-	 * @tests java.io.DataOutputStream#DataOutputStream(java.io.OutputStream)
-	 */
-	public void test_ConstructorLjava_io_OutputStream() {
-		// Test for method java.io.DataOutputStream(java.io.OutputStream)
-		assertTrue("Used in all tests", true);
-	}
-
-	/**
-	 * @tests java.io.DataOutputStream#flush()
-	 */
-	public void test_flush() {
-		// Test for method void java.io.DataOutputStream.flush()
-		try {
-			os.writeInt(9087589);
-			os.flush();
-			openDataInputStream();
-			int c = dis.readInt();
-			dis.close();
-			assertEquals("Failed to flush correctly", 9087589, c);
-		} catch (IOException e) {
-			fail("Exception during flush test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataOutputStream#size()
-	 */
-	public void test_size() {
-		// Test for method int java.io.DataOutputStream.size()
-
-		try {
-			os.write(fileString.getBytes(), 0, 150);
-			os.close();
-			openDataInputStream();
-			byte[] rbuf = new byte[150];
-			dis.read(rbuf, 0, 150);
-			dis.close();
-			assertEquals("Incorrect size returned", 150, os.size());
-		} catch (IOException e) {
-			fail("Exception during write test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataOutputStream#write(byte[], int, int)
-	 */
-	public void test_write$BII() {
-		// Test for method void java.io.DataOutputStream.write(byte [], int,
-		// int)
-		try {
-			os.write(fileString.getBytes(), 0, 150);
-			os.close();
-			openDataInputStream();
-			byte[] rbuf = new byte[150];
-			dis.read(rbuf, 0, 150);
-			dis.close();
-			assertTrue("Incorrect bytes written", new String(rbuf, 0, 150)
-					.equals(fileString.substring(0, 150)));
-		} catch (IOException e) {
-			fail("Exception during write test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataOutputStream#write(int)
-	 */
-	public void test_writeI() {
-		// Test for method void java.io.DataOutputStream.write(int)
-		try {
-			os.write((int) 't');
-			os.close();
-			openDataInputStream();
-			int c = dis.read();
-			dis.close();
-			assertTrue("Incorrect int written", (int) 't' == c);
-		} catch (IOException e) {
-			fail("Exception during write test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataOutputStream#writeBoolean(boolean)
-	 */
-	public void test_writeBooleanZ() {
-		// Test for method void java.io.DataOutputStream.writeBoolean(boolean)
-		try {
-			os.writeBoolean(true);
-			os.close();
-			openDataInputStream();
-			boolean c = dis.readBoolean();
-			dis.close();
-			assertTrue("Incorrect boolean written", c);
-		} catch (IOException e) {
-			fail("Exception during writeBoolean test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataOutputStream#writeByte(int)
-	 */
-	public void test_writeByteI() {
-		// Test for method void java.io.DataOutputStream.writeByte(int)
-		try {
-			os.writeByte((byte) 127);
-			os.close();
-			openDataInputStream();
-			byte c = dis.readByte();
-			dis.close();
-			assertTrue("Incorrect byte written", c == (byte) 127);
-		} catch (IOException e) {
-			fail("Exception during writeByte test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataOutputStream#writeBytes(java.lang.String)
-	 */
-	public void test_writeBytesLjava_lang_String() throws IOException {
-		// Test for method void
-		// java.io.DataOutputStream.writeBytes(java.lang.String)
-		try {
-			os.write(fileString.getBytes());
-			os.close();
-			openDataInputStream();
-			byte[] rbuf = new byte[4000];
-			dis.read(rbuf, 0, fileString.length());
-			dis.close();
-			assertTrue("Incorrect bytes written", new String(rbuf, 0,
-					fileString.length()).equals(fileString));
-		} catch (IOException e) {
-			fail("Exception during writeBytes test : " + e.getMessage());
-		}
-		// regression test for HARMONY-1101
-		new DataOutputStream(null).writeBytes("");
-	}
-
-	/**
-	 * @tests java.io.DataOutputStream#writeChar(int)
-	 */
-	public void test_writeCharI() {
-		// Test for method void java.io.DataOutputStream.writeChar(int)
-		try {
-			os.writeChar('T');
-			os.close();
-			openDataInputStream();
-			char c = dis.readChar();
-			dis.close();
-			assertEquals("Incorrect char written", 'T', c);
-		} catch (IOException e) {
-			fail("Exception during writeChar test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataOutputStream#writeChars(java.lang.String)
-	 */
-	public void test_writeCharsLjava_lang_String() {
-		// Test for method void
-		// java.io.DataOutputStream.writeChars(java.lang.String)
-		try {
-			os.writeChars("Test String");
-			os.close();
-			openDataInputStream();
-			char[] chars = new char[50];
-			int i, a = dis.available() / 2;
-			for (i = 0; i < a; i++)
-				chars[i] = dis.readChar();
-			assertEquals("Incorrect chars written", "Test String", new String(chars, 0, i)
-					);
-		} catch (IOException e) {
-			fail("Exception during writeChars test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataOutputStream#writeDouble(double)
-	 */
-	public void test_writeDoubleD() {
-		// Test for method void java.io.DataOutputStream.writeDouble(double)
-		try {
-			os.writeDouble(908755555456.98);
-			os.close();
-			openDataInputStream();
-			double c = dis.readDouble();
-			dis.close();
-			assertEquals("Incorrect double written", 908755555456.98, c);
-		} catch (IOException e) {
-			fail("Exception during writeDouble test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataOutputStream#writeFloat(float)
-	 */
-	public void test_writeFloatF() {
-		// Test for method void java.io.DataOutputStream.writeFloat(float)
-		try {
-			os.writeFloat(9087.456f);
-			os.close();
-			openDataInputStream();
-			float c = dis.readFloat();
-			dis.close();
-			assertTrue("Incorrect float written", c == 9087.456f);
-		} catch (IOException e) {
-			fail("Exception during writeFloattest : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataOutputStream#writeInt(int)
-	 */
-	public void test_writeIntI() {
-		// Test for method void java.io.DataOutputStream.writeInt(int)
-		try {
-			os.writeInt(9087589);
-			os.close();
-			openDataInputStream();
-			int c = dis.readInt();
-			dis.close();
-			assertEquals("Incorrect int written", 9087589, c);
-		} catch (IOException e) {
-			fail("Exception during writeInt test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataOutputStream#writeLong(long)
-	 */
-	public void test_writeLongJ() {
-		// Test for method void java.io.DataOutputStream.writeLong(long)
-		try {
-			os.writeLong(908755555456L);
-			os.close();
-			openDataInputStream();
-			long c = dis.readLong();
-			dis.close();
-			assertEquals("Incorrect long written", 908755555456L, c);
-		} catch (IOException e) {
-			fail("Exception during writeLong test" + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataOutputStream#writeShort(int)
-	 */
-	public void test_writeShortI() {
-		// Test for method void java.io.DataOutputStream.writeShort(int)
-		try {
-			os.writeShort((short) 9087);
-			os.close();
-			openDataInputStream();
-			short c = dis.readShort();
-			dis.close();
-			assertEquals("Incorrect short written", 9087, c);
-		} catch (IOException e) {
-			fail("Exception during writeShort test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.io.DataOutputStream#writeUTF(java.lang.String)
-	 */
-	public void test_writeUTFLjava_lang_String() throws Exception {
-		// Test for method void
-		// java.io.DataOutputStream.writeUTF(java.lang.String)
-                os.writeUTF(unihw);
+    public String fileString = "Test_All_Tests\nTest_java_io_BufferedInputStream\nTest_java_io_BufferedOutputStream\nTest_java_io_ByteArrayInputStream\nTest_java_io_ByteArrayOutputStream\nTest_java_io_DataInputStream\n";
+
+    /**
+     * @tests java.io.DataOutputStream#DataOutputStream(java.io.OutputStream)
+     */
+    public void test_ConstructorLjava_io_OutputStream() {
+        assertTrue("Used in all tests", true);
+    }
+
+    /**
+     * @tests java.io.DataOutputStream#flush()
+     */
+    public void test_flush() throws IOException {
+        os.writeInt(9087589);
+        os.flush();
+        openDataInputStream();
+        int c = dis.readInt();
+        dis.close();
+        assertEquals("Failed to flush correctly", 9087589, c);
+    }
+
+    /**
+     * @tests java.io.DataOutputStream#size()
+     */
+    public void test_size() throws IOException {
+        os.write(fileString.getBytes(), 0, 150);
+        os.close();
+        openDataInputStream();
+        byte[] rbuf = new byte[150];
+        dis.read(rbuf, 0, 150);
+        dis.close();
+        assertEquals("Incorrect size returned", 150, os.size());
+    }
+
+    /**
+     * @tests java.io.DataOutputStream#write(byte[], int, int)
+     */
+    public void test_write$BII() throws IOException {
+        os.write(fileString.getBytes(), 0, 150);
+        os.close();
+        openDataInputStream();
+        byte[] rbuf = new byte[150];
+        dis.read(rbuf, 0, 150);
+        dis.close();
+        assertTrue("Incorrect bytes written", new String(rbuf, 0, 150)
+                .equals(fileString.substring(0, 150)));
+    }
+
+    /**
+     * @tests java.io.DataOutputStream#write(int)
+     */
+    public void test_writeI() throws IOException {
+        os.write((int) 't');
+        os.close();
+        openDataInputStream();
+        int c = dis.read();
+        dis.close();
+        assertTrue("Incorrect int written", (int) 't' == c);
+    }
+
+    /**
+     * @tests java.io.DataOutputStream#writeBoolean(boolean)
+     */
+    public void test_writeBooleanZ() throws IOException {
+        os.writeBoolean(true);
+        os.close();
+        openDataInputStream();
+        boolean c = dis.readBoolean();
+        dis.close();
+        assertTrue("Incorrect boolean written", c);
+    }
+
+    /**
+     * @tests java.io.DataOutputStream#writeByte(int)
+     */
+    public void test_writeByteI() throws IOException {
+        os.writeByte((byte) 127);
+        os.close();
+        openDataInputStream();
+        byte c = dis.readByte();
+        dis.close();
+        assertTrue("Incorrect byte written", c == (byte) 127);
+    }
+
+    /**
+     * @tests java.io.DataOutputStream#writeBytes(java.lang.String)
+     */
+    public void test_writeBytesLjava_lang_String() throws IOException {
+        os.write(fileString.getBytes());
+        os.close();
+        openDataInputStream();
+        byte[] rbuf = new byte[4000];
+        dis.read(rbuf, 0, fileString.length());
+        dis.close();
+        assertTrue("Incorrect bytes written", new String(rbuf, 0, fileString
+                .length()).equals(fileString));
+
+        // regression test for HARMONY-1101
+        new DataOutputStream(null).writeBytes("");
+    }
+
+    /**
+     * @tests java.io.DataOutputStream#writeChar(int)
+     */
+    public void test_writeCharI() throws IOException {
+        os.writeChar('T');
+        os.close();
+        openDataInputStream();
+        char c = dis.readChar();
+        dis.close();
+        assertEquals("Incorrect char written", 'T', c);
+    }
+
+    /**
+     * @tests java.io.DataOutputStream#writeChars(java.lang.String)
+     */
+    public void test_writeCharsLjava_lang_String() throws IOException {
+        os.writeChars("Test String");
+        os.close();
+        openDataInputStream();
+        char[] chars = new char[50];
+        int i, a = dis.available() / 2;
+        for (i = 0; i < a; i++)
+            chars[i] = dis.readChar();
+        assertEquals("Incorrect chars written", "Test String", new String(
+                chars, 0, i));
+    }
+
+    /**
+     * @tests java.io.DataOutputStream#writeDouble(double)
+     */
+    public void test_writeDoubleD() throws IOException {
+        os.writeDouble(908755555456.98);
+        os.close();
+        openDataInputStream();
+        double c = dis.readDouble();
+        dis.close();
+        assertEquals("Incorrect double written", 908755555456.98, c);
+    }
+
+    /**
+     * @tests java.io.DataOutputStream#writeFloat(float)
+     */
+    public void test_writeFloatF() throws IOException {
+        os.writeFloat(9087.456f);
+        os.close();
+        openDataInputStream();
+        float c = dis.readFloat();
+        dis.close();
+        assertTrue("Incorrect float written", c == 9087.456f);
+    }
+
+    /**
+     * @tests java.io.DataOutputStream#writeInt(int)
+     */
+    public void test_writeIntI() throws IOException {
+        os.writeInt(9087589);
+        os.close();
+        openDataInputStream();
+        int c = dis.readInt();
+        dis.close();
+        assertEquals("Incorrect int written", 9087589, c);
+    }
+
+    /**
+     * @tests java.io.DataOutputStream#writeLong(long)
+     */
+    public void test_writeLongJ() throws IOException {
+        os.writeLong(908755555456L);
+        os.close();
+        openDataInputStream();
+        long c = dis.readLong();
+        dis.close();
+        assertEquals("Incorrect long written", 908755555456L, c);
+    }
+
+    /**
+     * @tests java.io.DataOutputStream#writeShort(int)
+     */
+    public void test_writeShortI() throws IOException {
+        os.writeShort((short) 9087);
+        os.close();
+        openDataInputStream();
+        short c = dis.readShort();
+        dis.close();
+        assertEquals("Incorrect short written", 9087, c);
+    }
+
+    /**
+     * @tests java.io.DataOutputStream#writeUTF(java.lang.String)
+     */
+    public void test_writeUTFLjava_lang_String() throws IOException {
+        os.writeUTF(unihw);
+        os.close();
+        openDataInputStream();
+        assertTrue("Failed to write string in UTF format",
+                dis.available() == unihw.length() + 2);
+        assertTrue("Incorrect string returned", dis.readUTF().equals(unihw));
+    }
+
+    private void openDataInputStream() throws IOException {
+        dis = new DataInputStream(new ByteArrayInputStream(bos.toByteArray()));
+    }
+
+    /**
+     * Sets up the fixture, for example, open a network connection. This method
+     * is called before a test is executed.
+     */
+    protected void setUp() {
+        bos = new ByteArrayOutputStream();
+        os = new DataOutputStream(bos);
+    }
+
+    /**
+     * Tears down the fixture, for example, close a network connection. This
+     * method is called after a test is executed.
+     */
+    protected void tearDown() {
+        try {
+            if (os != null)
                 os.close();
-                openDataInputStream();
-                assertTrue("Failed to write string in UTF format",
-                                dis.available() == unihw.length() + 2);
-                assertTrue("Incorrect string returned", dis.readUTF().equals(unihw));
-	}
-
-	private void openDataInputStream() throws IOException {
-		dis = new DataInputStream(new ByteArrayInputStream(bos.toByteArray()));
-	}
-
-	/**
-	 * Sets up the fixture, for example, open a network connection. This method
-	 * is called before a test is executed.
-	 */
-	protected void setUp() {
-		bos = new ByteArrayOutputStream();
-		os = new DataOutputStream(bos);
-	}
-
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
-		try {
-			if (os != null)
-				os.close();
-			if (dis != null)
-				dis.close();
-		} catch (IOException e) {
-		}
-	}
+            if (dis != null)
+                dis.close();
+        } catch (IOException e) {
+        }
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/EOFExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/EOFExceptionTest.java?rev=612569&r1=612568&r2=612569&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/EOFExceptionTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/EOFExceptionTest.java Wed Jan 16 12:56:03 2008
@@ -20,48 +20,33 @@
 import java.io.ByteArrayInputStream;
 import java.io.DataInputStream;
 import java.io.EOFException;
+import java.io.IOException;
 
 public class EOFExceptionTest extends junit.framework.TestCase {
 
-	/**
-	 * @tests java.io.EOFException#EOFException()
-	 */
-	public void test_Constructor() throws Exception {
-		// Test for method java.io.EOFException()
-		try {
-			new DataInputStream(new ByteArrayInputStream(new byte[1]))
-					.readShort();
-		} catch (EOFException e) {
-			return;
-		}
-		fail("Failed to generate EOFException");
-	}
+    /**
+     * @tests java.io.EOFException#EOFException()
+     */
+    public void test_Constructor() throws Exception {
+        try {
+            new DataInputStream(new ByteArrayInputStream(new byte[1]))
+                    .readShort();
+            fail("Failed to generate EOFException");
+        } catch (EOFException e) {
+            // Expected
+        }
+    }
 
-	/**
-	 * @tests java.io.EOFException#EOFException(java.lang.String)
-	 */
-	public void test_ConstructorLjava_lang_String() throws Exception {
-		// Test for method java.io.EOFException(java.lang.String)
-		try {
-			new DataInputStream(new ByteArrayInputStream(new byte[1]))
-					.readShort();
-		} catch (EOFException e) {
-			return;
-		}
-		fail("Failed to generate EOFException");
-	}
-
-	/**
-	 * Sets up the fixture, for example, open a network connection. This method
-	 * is called before a test is executed.
-	 */
-	protected void setUp() {
-	}
-
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
-	}
+    /**
+     * @tests java.io.EOFException#EOFException(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() throws IOException {
+        try {
+            new DataInputStream(new ByteArrayInputStream(new byte[1]))
+                    .readShort();
+            fail("Failed to generate EOFException");
+        } catch (EOFException e) {
+            // Expected
+        }
+    }
 }



Mime
View raw message