You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by kr...@apache.org on 2015/12/19 09:52:51 UTC
svn commit: r1720890 -
/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CharSequenceInputStreamTest.java
Author: krosenvold
Date: Sat Dec 19 08:52:51 2015
New Revision: 1720890
URL: http://svn.apache.org/viewvc?rev=1720890&view=rev
Log:
Added exclude for legacy charcsets that do not support french characters (relevant on IBM JDK)
Modified:
commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CharSequenceInputStreamTest.java
Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CharSequenceInputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CharSequenceInputStreamTest.java?rev=1720890&r1=1720889&r2=1720890&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CharSequenceInputStreamTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CharSequenceInputStreamTest.java Sat Dec 19 08:52:51 2015
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertArr
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
import java.io.IOException;
import java.io.InputStream;
@@ -68,8 +69,8 @@ public class CharSequenceInputStreamTest
} else {
assertTrue("Read " + read + " <= " + bufferLength, read <= bufferLength);
while (read > 0) {
- assertTrue("offset " + offset + " < " + expected.length, offset < expected.length);
- assertEquals("bytes should agree", expected[offset], buffer[bufferOffset]);
+ assertTrue("offset for " + charsetName +" " + offset + " < " + expected.length, offset < expected.length);
+ assertEquals("bytes should agree for " + charsetName, expected[offset], buffer[bufferOffset]);
offset++;
bufferOffset++;
read--;
@@ -426,14 +427,26 @@ public class CharSequenceInputStreamTest
// at org.apache.commons.io.input.CharSequenceInputStreamTest.testAvailableRead(CharSequenceInputStreamTest.java:412)
// at org.apache.commons.io.input.CharSequenceInputStreamTest.testAvailable(CharSequenceInputStreamTest.java:424)
- if (isAvailabilityTestableForCharset(csName)) {
- testAvailableSkip(csName);
- testAvailableRead(csName);
+ try {
+ if (isAvailabilityTestableForCharset(csName)) {
+ testAvailableSkip(csName);
+ testAvailableRead(csName);
+ }
+ } catch (UnsupportedOperationException e){
+ fail("Operation not supported for " + csName);
}
}
}
private boolean isAvailabilityTestableForCharset(final String csName) {
- return Charset.forName(csName).canEncode() && ! "COMPOUND_TEXT".equalsIgnoreCase(csName) && ! "x-COMPOUND_TEXT".equalsIgnoreCase(csName);
+ return Charset.forName(csName).canEncode()
+ && !"COMPOUND_TEXT".equalsIgnoreCase(csName) && !"x-COMPOUND_TEXT".equalsIgnoreCase(csName)
+ && !isOddBallLegacyCharsetThatDoesNotSupportFrenchCharacters(csName);
+ }
+
+ private boolean isOddBallLegacyCharsetThatDoesNotSupportFrenchCharacters(String csName) {
+ return "x-IBM1388".equalsIgnoreCase(csName) ||
+ "ISO-2022-CN".equalsIgnoreCase(csName) ||
+ "ISO-2022-JP".equalsIgnoreCase(csName);
}
}