mirror of https://github.com/apache/activemq.git
exercise all unicode for byte array stream write/readUTF to validate
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@908618 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2b019ea627
commit
0701d7d0e6
|
@ -26,14 +26,40 @@ public class DataByteArrayInputStreamTest extends TestCase {
|
||||||
public void testNonAscii() throws Exception {
|
public void testNonAscii() throws Exception {
|
||||||
doMarshallUnMarshallValidation("meißen");
|
doMarshallUnMarshallValidation("meißen");
|
||||||
|
|
||||||
|
String accumulator = new String();
|
||||||
|
|
||||||
int test = 0; // int to get Supplementary chars
|
int test = 0; // int to get Supplementary chars
|
||||||
while(Character.isDefined(test)) {
|
while(Character.isDefined(test)) {
|
||||||
doMarshallUnMarshallValidation(String.valueOf((char)test));
|
String toTest = String.valueOf((char)test);
|
||||||
|
accumulator += toTest;
|
||||||
|
doMarshallUnMarshallValidation(toTest);
|
||||||
test++;
|
test++;
|
||||||
}
|
}
|
||||||
|
|
||||||
int massiveThreeByteCharValue = 0x0FFF;
|
int massiveThreeByteCharValue = 0x0FFF;
|
||||||
|
String toTest = String.valueOf((char)massiveThreeByteCharValue);
|
||||||
|
accumulator += toTest;
|
||||||
doMarshallUnMarshallValidation(String.valueOf((char)massiveThreeByteCharValue));
|
doMarshallUnMarshallValidation(String.valueOf((char)massiveThreeByteCharValue));
|
||||||
|
|
||||||
|
// Altogether
|
||||||
|
doMarshallUnMarshallValidation(accumulator);
|
||||||
|
|
||||||
|
// the three byte values
|
||||||
|
char t = '\u0800';
|
||||||
|
final char max = '\uffff';
|
||||||
|
accumulator = String.valueOf(t);
|
||||||
|
while (t < max) {
|
||||||
|
String val = String.valueOf(t);
|
||||||
|
accumulator += val;
|
||||||
|
doMarshallUnMarshallValidation(val);
|
||||||
|
t++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Altogether so long as it is not too big
|
||||||
|
while (accumulator.length() > 20000) {
|
||||||
|
accumulator = accumulator.substring(20000);
|
||||||
|
}
|
||||||
|
doMarshallUnMarshallValidation(accumulator);
|
||||||
}
|
}
|
||||||
|
|
||||||
void doMarshallUnMarshallValidation(String value) throws Exception {
|
void doMarshallUnMarshallValidation(String value) throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue