Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 1595 invoked from network); 29 Apr 2009 16:44:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 29 Apr 2009 16:44:01 -0000 Received: (qmail 47629 invoked by uid 500); 29 Apr 2009 16:44:00 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 47612 invoked by uid 500); 29 Apr 2009 16:44:00 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 47603 invoked by uid 99); 29 Apr 2009 16:44:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Apr 2009 16:44:00 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Apr 2009 16:44:00 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D907423889DE; Wed, 29 Apr 2009 16:43:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r769824 - in /harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io: BufferedInputStreamTest.java ByteArrayInputStreamTest.java ByteArrayOutputStreamTest.java Date: Wed, 29 Apr 2009 16:43:39 -0000 To: commits@harmony.apache.org From: odeakin@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090429164339.D907423889DE@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: odeakin Date: Wed Apr 29 16:43:38 2009 New Revision: 769824 URL: http://svn.apache.org/viewvc?rev=769824&view=rev Log: Make sure bytes are UTF-8 encoded when making assertion checks Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedInputStreamTest.java harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/ByteArrayInputStreamTest.java harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/ByteArrayOutputStreamTest.java Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedInputStreamTest.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedInputStreamTest.java?rev=769824&r1=769823&r2=769824&view=diff ============================================================================== --- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedInputStreamTest.java (original) +++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedInputStreamTest.java Wed Apr 29 16:43:38 2009 @@ -24,6 +24,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; import java.io.OutputStream; import junit.framework.TestCase; import tests.support.Support_PlatformFile; @@ -265,7 +266,8 @@ * @tests java.io.BufferedInputStream#read() */ public void test_read() throws IOException { - int c = is.read(); + InputStreamReader isr = new InputStreamReader(is); + int c = isr.read(); assertTrue("read returned incorrect char", c == fileString.charAt(0)); byte[] bytes = new byte[256]; Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/ByteArrayInputStreamTest.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/ByteArrayInputStreamTest.java?rev=769824&r1=769823&r2=769824&view=diff ============================================================================== --- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/ByteArrayInputStreamTest.java (original) +++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/ByteArrayInputStreamTest.java Wed Apr 29 16:43:38 2009 @@ -20,6 +20,7 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; public class ByteArrayInputStreamTest extends junit.framework.TestCase { @@ -113,7 +114,8 @@ * @tests ByteArrayInputStream#read() */ public void test_read() throws IOException { - int c = is.read(); + InputStreamReader isr = new InputStreamReader(is); + int c = isr.read(); is.reset(); assertTrue("read returned incorrect char", c == fileString.charAt(0)); } 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=769824&r1=769823&r2=769824&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 Apr 29 16:43:38 2009 @@ -21,6 +21,7 @@ import java.io.FileDescriptor; import java.io.FileOutputStream; import java.io.IOException; +import java.io.UnsupportedEncodingException; import junit.framework.TestCase; @@ -126,12 +127,12 @@ public void test_toStringLjava_lang_String() throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); - bos.write(fileString.getBytes(), 0, fileString.length()); + bos.write(fileString.getBytes("UTF-8"), 0, fileString.length()); assertTrue("Returned incorrect 8859-1 String", bos.toString("8859_1") .equals(fileString)); bos = new ByteArrayOutputStream(); - bos.write(fileString.getBytes(), 0, fileString.length()); + bos.write(fileString.getBytes("UTF-8"), 0, fileString.length()); assertTrue("Returned incorrect 8859-2 String", bos.toString("8859_2") .equals(fileString)); } @@ -160,12 +161,12 @@ /** * @tests java.io.ByteArrayOutputStream#write(int) */ - public void test_writeI() { + public void test_writeI() throws UnsupportedEncodingException { bos = new ByteArrayOutputStream(); bos.write('t'); byte[] result = bos.toByteArray(); assertEquals("Wrote incorrect bytes", "t", new String(result, 0, - result.length)); + result.length, "UTF-8")); } /**