harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lian...@apache.org
Subject svn commit: r517630 - /harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileWriterTest.java
Date Tue, 13 Mar 2007 10:22:20 GMT
Author: liangyx
Date: Tue Mar 13 03:22:18 2007
New Revision: 517630

URL: http://svn.apache.org/viewvc?view=rev&rev=517630
Log:
Apply patch for HARMONY([classlib][test] Add test for java.io.FileWriter's constructor FileWriter(java.io.File,
boolean))

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

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileWriterTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileWriterTest.java?view=diff&rev=517630&r1=517629&r2=517630
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileWriterTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileWriterTest.java
Tue Mar 13 03:22:18 2007
@@ -62,6 +62,50 @@
 		}
 	}
 
+    /**
+     * @tests java.io.FileWriter#FileWriter(java.io.File, boolean)
+     */
+    public void test_ConstructorLjava_io_FileZ() throws Exception {
+        // Test for method java.io.FileWriter(java.io.File)
+        //append = true
+        {
+            FileWriter fileWriter = new FileWriter(f);
+
+            String first = "The first string for testing. ";
+            fileWriter.write(first);
+            fileWriter.close();
+
+            fileWriter = new FileWriter(f, true);
+            String second = "The second String for testing.";
+            fileWriter.write(second);
+            fileWriter.close();
+
+            FileReader fileReader = new FileReader(f);
+            char[] out = new char[first.length() + second.length() + 10];
+            int length = fileReader.read(out);
+            fileReader.close();
+            assertEquals(first + second, new String(out, 0, length));
+        }
+        //append = false
+        {
+            FileWriter fileWriter = new FileWriter(f);
+            String first = "The first string for testing. ";
+            fileWriter.write(first);
+            fileWriter.close();
+
+            fileWriter = new FileWriter(f, false);
+            String second = "The second String for testing.";
+            fileWriter.write(second);
+            fileWriter.close();
+
+            FileReader fileReader = new FileReader(f);
+            char[] out = new char[first.length() + second.length() + 10];
+            int length = fileReader.read(out);
+            fileReader.close();
+            assertEquals(second, new String(out, 0, length));
+        }
+    }
+    
 	/**
 	 * @tests java.io.FileWriter#FileWriter(java.io.FileDescriptor)
 	 */



Mime
View raw message