fixed test to handle different default encodings

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2928 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2011-03-30 04:55:30 +00:00
parent 7ebc5c380b
commit 35f6b53e79
1 changed files with 6 additions and 5 deletions

View File

@ -14,6 +14,7 @@ import org.eclipse.jetty.io.ByteArrayBuffer;
import org.eclipse.jetty.io.ByteArrayEndPoint;
import org.eclipse.jetty.io.SimpleBuffers;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.TypeUtil;
import org.junit.Before;
import org.junit.Test;
@ -239,13 +240,11 @@ public class HttpWriterTest
}
String source = sb.toString();
byte[] bytes = source.getBytes("UTF-8"/* StringUtil.__UTF81 */);
byte[] bytes = source.getBytes(StringUtil.__UTF8);
_writer.write(source.toCharArray(),0,source.toCharArray().length);
java.io.ByteArrayOutputStream baos = new
java.io.ByteArrayOutputStream();
java.io.OutputStreamWriter osw = new java.io.OutputStreamWriter(baos/*
,StringUtil.__UTF8 */);
java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
java.io.OutputStreamWriter osw = new java.io.OutputStreamWriter(baos,StringUtil.__UTF8);
osw.write(source.toCharArray(),0,source.toCharArray().length);
osw.flush();
@ -254,6 +253,8 @@ java.io.ByteArrayOutputStream();
myReportBytes(_bytes.asArray());
assertArrayEquals(bytes,_bytes.asArray());
System.err.println(TypeUtil.toHexString(baos.toByteArray()));
System.err.println(TypeUtil.toHexString(_bytes.asArray()));
assertArrayEquals(baos.toByteArray(),_bytes.asArray());
}