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:
parent
7ebc5c380b
commit
35f6b53e79
|
@ -14,6 +14,7 @@ import org.eclipse.jetty.io.ByteArrayBuffer;
|
||||||
import org.eclipse.jetty.io.ByteArrayEndPoint;
|
import org.eclipse.jetty.io.ByteArrayEndPoint;
|
||||||
import org.eclipse.jetty.io.SimpleBuffers;
|
import org.eclipse.jetty.io.SimpleBuffers;
|
||||||
import org.eclipse.jetty.util.StringUtil;
|
import org.eclipse.jetty.util.StringUtil;
|
||||||
|
import org.eclipse.jetty.util.TypeUtil;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -239,13 +240,11 @@ public class HttpWriterTest
|
||||||
}
|
}
|
||||||
String source = sb.toString();
|
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);
|
_writer.write(source.toCharArray(),0,source.toCharArray().length);
|
||||||
|
|
||||||
java.io.ByteArrayOutputStream baos = new
|
java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
|
||||||
java.io.ByteArrayOutputStream();
|
java.io.OutputStreamWriter osw = new java.io.OutputStreamWriter(baos,StringUtil.__UTF8);
|
||||||
java.io.OutputStreamWriter osw = new java.io.OutputStreamWriter(baos/*
|
|
||||||
,StringUtil.__UTF8 */);
|
|
||||||
osw.write(source.toCharArray(),0,source.toCharArray().length);
|
osw.write(source.toCharArray(),0,source.toCharArray().length);
|
||||||
osw.flush();
|
osw.flush();
|
||||||
|
|
||||||
|
@ -254,6 +253,8 @@ java.io.ByteArrayOutputStream();
|
||||||
myReportBytes(_bytes.asArray());
|
myReportBytes(_bytes.asArray());
|
||||||
|
|
||||||
assertArrayEquals(bytes,_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());
|
assertArrayEquals(baos.toByteArray(),_bytes.asArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue