harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r395577 - /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/RandomAccessFileTest.java
Date Thu, 20 Apr 2006 12:47:40 GMT
Author: mloenko
Date: Thu Apr 20 05:47:39 2006
New Revision: 395577

URL: http://svn.apache.org/viewcvs?rev=395577&view=rev
Log:
regression test for HARMONY-374, clean-up for another regression test

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/RandomAccessFileTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/RandomAccessFileTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/RandomAccessFileTest.java?rev=395577&r1=395576&r2=395577&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/RandomAccessFileTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/RandomAccessFileTest.java
Thu Apr 20 05:47:39 2006
@@ -567,82 +567,97 @@
         raf.close();
     }
 
-    //regression test for HARMONY-377
+    /**
+     * @tests java.io.RandomAccessFile#seek(long)
+     * 
+     * Regression for HARMONY-374
+     */
+    public void test_seekI() throws IOException {
+        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
+        try {
+            raf.seek(-1);
+            fail("IOException must be thrown if pos < 0");
+        } catch (IOException e) {
+        }
+    }
+
+    /**
+     * @tests java.io.RandomAccessFile#read(byte[], int, int)
+     * 
+     * Regression for HARMONY-377
+     */
     public void test_readBII() throws IOException {
-        File file = File.createTempFile("xxx", "yyy");
-        file.deleteOnExit();
-        RandomAccessFile rfl = new RandomAccessFile(file, "rw");
+        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
         try {
-            rfl.read(new byte[1], -1, 1);
+            raf.read(new byte[1], -1, 1);
             fail("IndexOutOfBoundsException must be thrown if off <0");
         } catch (IndexOutOfBoundsException e) {
-            // expected
         }
 
         try {
-            rfl.read(new byte[1], 0, -1);
+            raf.read(new byte[1], 0, -1);
             fail("IndexOutOfBoundsException must be thrown if len <0");
         } catch (IndexOutOfBoundsException e) {
-            // expected 
         }
 
         try {
-            rfl.read(new byte[1], 0, 5);
+            raf.read(new byte[1], 0, 5);
             fail("IndexOutOfBoundsException must be thrown if off+len > b.lengh");
         } catch (IndexOutOfBoundsException e) {
-            // expected
         }
 
         try {
-            rfl.read(new byte[10], Integer.MAX_VALUE, 5);
+            raf.read(new byte[10], Integer.MAX_VALUE, 5);
             fail("IndexOutOfBoundsException expected");
         } catch (IndexOutOfBoundsException e) {
         }
 
         try {
-            rfl.read(new byte[10], 5, Integer.MAX_VALUE);
+            raf.read(new byte[10], 5, Integer.MAX_VALUE);
             fail("IndexOutOfBoundsException expected");
         } catch (IndexOutOfBoundsException e) {
         }
 
-        rfl.close();
+        raf.close();
     }
 
-    //regression test for HARMONY-377
+    /**
+     * @tests java.io.RandomAccessFile#write(byte[], int, int)
+     * 
+     * Regression for HARMONY-377
+     */
     public void test_writeBII() throws IOException {
-        File file = File.createTempFile("xxx", "yyy");
-        file.deleteOnExit();
-        RandomAccessFile rfl = new RandomAccessFile(file, "rw");
+        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
         try {
-            rfl.write(new byte[1], -1, 1);
+            raf.write(new byte[1], -1, 1);
             fail("IndexOutOfBoundsException must be thrown if off <0");
         } catch (IndexOutOfBoundsException e) {
         }
 
         try {
-            rfl.write(new byte[1], 0, -1);
+            raf.write(new byte[1], 0, -1);
             fail("IndexOutOfBoundsException must be thrown if len <0");
         } catch (IndexOutOfBoundsException e) {
         }
 
         try {
-            rfl.write(new byte[1], 0, 5);
+            raf.write(new byte[1], 0, 5);
             fail("IndexOutOfBoundsException must be thrown if off+len > b.lengh");
         } catch (IndexOutOfBoundsException e) {
         }
 
         try {
-            rfl.write(new byte[10], Integer.MAX_VALUE, 5);
+            raf.write(new byte[10], Integer.MAX_VALUE, 5);
             fail("IndexOutOfBoundsException expected");
         } catch (IndexOutOfBoundsException e) {
         }
 
         try {
-            rfl.write(new byte[10], 5, Integer.MAX_VALUE);
+            raf.write(new byte[10], 5, Integer.MAX_VALUE);
             fail("IndexOutOfBoundsException expected");
         } catch (IndexOutOfBoundsException e) {
         }
-        rfl.close();
+        raf.close();
     }
 
     /**



Mime
View raw message