Adding UTF8 fast fail test case that doesn't fail as expected on the websocket side
This commit is contained in:
parent
889d20ba55
commit
0f4fe634a3
|
@ -46,7 +46,7 @@ public class Utf8StringBuilderTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFastFail() throws Exception
|
||||
public void testFastFail_1() throws Exception
|
||||
{
|
||||
byte[] part1 = TypeUtil.fromHexString("cebae1bdb9cf83cebcceb5");
|
||||
byte[] part2 = TypeUtil.fromHexString("f4908080"); // INVALID
|
||||
|
@ -68,6 +68,30 @@ public class Utf8StringBuilderTest
|
|||
// Part 3 is valid
|
||||
buffer.append(part3,0,part3.length);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFastFail_2() throws Exception
|
||||
{
|
||||
byte[] part1 = TypeUtil.fromHexString("cebae1bdb9cf83cebcceb5f4");
|
||||
byte[] part2 = TypeUtil.fromHexString("90"); // INVALID
|
||||
byte[] part3 = TypeUtil.fromHexString("8080656469746564");
|
||||
|
||||
Utf8StringBuilder buffer = new Utf8StringBuilder();
|
||||
// Part 1 is valid
|
||||
buffer.append(part1,0,part1.length);
|
||||
try
|
||||
{
|
||||
// Part 2 is invalid
|
||||
buffer.append(part2,0,part2.length);
|
||||
Assert.fail("Should have thrown a NotUtf8Exception");
|
||||
}
|
||||
catch (Utf8Appendable.NotUtf8Exception e)
|
||||
{
|
||||
// expected path
|
||||
}
|
||||
// Part 3 is valid
|
||||
buffer.append(part3,0,part3.length);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUtfStringBuilder() throws Exception
|
||||
|
|
Loading…
Reference in New Issue