From 9a0df21251d55b30b2c34d72a35343c36a6210c3 Mon Sep 17 00:00:00 2001 From: Olyutorskii Date: Wed, 17 Apr 2013 20:12:37 +0900 Subject: [PATCH] =?utf8?q?JRE1.6=E3=81=A81.7=E3=81=AE=E5=B7=AE=E3=82=92?= =?utf8?q?=E5=90=B8=E5=8F=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/test/java/jp/sfjp/mikutoga/bin/export/TextExporterTest.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/test/java/jp/sfjp/mikutoga/bin/export/TextExporterTest.java b/src/test/java/jp/sfjp/mikutoga/bin/export/TextExporterTest.java index d3a07f4..e1af900 100644 --- a/src/test/java/jp/sfjp/mikutoga/bin/export/TextExporterTest.java +++ b/src/test/java/jp/sfjp/mikutoga/bin/export/TextExporterTest.java @@ -106,8 +106,12 @@ public class TextExporterTest { ByteArrayOutputStream bout = new ByteArrayOutputStream(); exporter = new TextExporter(CS_UTF8); + // JRE 1.6 と 1.7 でびみょーに違う + float maxb = CS_UTF8.newEncoder().maxBytesPerChar(); + exporter.setCharBufSize(1); - exporter.setByteBufSize(4); + int minb = (int)( StrictMath.floor(maxb) ); + exporter.setByteBufSize(minb); bout.reset(); try{ exporter.encodeToByteStream("あいう", bout); @@ -117,7 +121,8 @@ public class TextExporterTest { assertEquals(9, bout.size()); try{ - exporter.setByteBufSize(3); + int failSize = minb - 1; + exporter.setByteBufSize(failSize); fail(); }catch(IllegalArgumentException e){ // GOOD -- 2.11.0