harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r770608 - in /harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io: LineNumberInputStreamTest.java LineNumberReaderTest.java
Date Fri, 01 May 2009 10:11:18 GMT
Author: odeakin
Date: Fri May  1 10:11:17 2009
New Revision: 770608

URL: http://svn.apache.org/viewvc?rev=770608&view=rev
Log:
Make sure test data is in UTF-8.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/LineNumberInputStreamTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/LineNumberReaderTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/LineNumberInputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/LineNumberInputStreamTest.java?rev=770608&r1=770607&r2=770608&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/LineNumberInputStreamTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/LineNumberInputStreamTest.java
Fri May  1 10:11:17 2009
@@ -20,6 +20,7 @@
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.LineNumberInputStream;
+import java.io.UnsupportedEncodingException;
 
 import junit.framework.TestCase;
 
@@ -98,11 +99,11 @@
     /**
      * @tests java.io.LineNumberInputStream#read(byte[], int, int)
      */
-    public void test_read$BII() throws IOException {
+    public void test_read$BII() throws IOException, UnsupportedEncodingException {
         byte[] buf = new byte[100];
         lnis.read(buf, 0, 100);
         assertTrue("Failed to read correct bytes on normal text", new String(
-                buf, 0, 100).equals(text.substring(0, 100)));
+                buf, 0, 100, "UTF-8").equals(text.substring(0, 100)));
     }
 
     /**
@@ -149,7 +150,7 @@
      * Sets up the fixture, for example, open a network connection. This method
      * is called before a test is executed.
      */
-    protected void setUp() {
+    protected void setUp() throws UnsupportedEncodingException {
         /*
          * In order for IOException to be thrown in reset(),the inputStream to
          * the constructor cannot be a byteArrayInputstream because the reset()
@@ -158,9 +159,9 @@
          * than the readlimit in mark inorder for IOException to be thrown
          */
         BufferedInputStream buftemp = new BufferedInputStream(
-                new ByteArrayInputStream(text.getBytes()), 4);
+                new ByteArrayInputStream(text.getBytes("UTF-8")), 4);
         lnis = new LineNumberInputStream(buftemp);
         lnis2 = new LineNumberInputStream(new ByteArrayInputStream(dosText
-                .getBytes()));
+                .getBytes("UTF-8")));
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/LineNumberReaderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/LineNumberReaderTest.java?rev=770608&r1=770607&r2=770608&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/LineNumberReaderTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/LineNumberReaderTest.java
Fri May  1 10:11:17 2009
@@ -119,11 +119,11 @@
         // Regression for HARMONY-4294
         byte[] buffer = new byte[] { '\r', '\n' };
         LineNumberReader reader = new LineNumberReader(new InputStreamReader(
-                new ByteArrayInputStream(buffer)));
+                new ByteArrayInputStream(buffer), "UTF-8"));
         assertEquals('\n', reader.read());
         assertEquals(-1, reader.read());
         reader = new LineNumberReader(new InputStreamReader(
-                new ByteArrayInputStream(buffer)));
+                new ByteArrayInputStream(buffer), "UTF-8"));
         assertNotNull(reader.readLine());
         assertNull(reader.readLine());
     }



Mime
View raw message