Skip to content

Commit

Permalink
Minor test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Aug 30, 2023
1 parent b29e3b1 commit 0beb6fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ public void testMangledFloatsChars() throws Exception {

private void _testMangledNonRootInts(int mode) throws Exception
{
JsonParser p = createParser(mode, "[ 123true ]");
assertToken(JsonToken.START_ARRAY, p.nextToken());
try {
try (JsonParser p = createParser(mode, "[ 123true ]")) {
assertToken(JsonToken.START_ARRAY, p.nextToken());
JsonToken t = p.nextToken();
fail("Should have gotten an exception; instead got token: "+t);
} catch (JsonParseException e) {
verifyException(e, "expected space");
}
p.close();
}

private void _testMangledNonRootFloats(int mode) throws Exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,14 @@ private void _testNonRootMangledFloats679(int mode) throws Exception {
private void _testNonRootMangledFloats679(int mode, String value) throws Exception
{
// Also test with floats
JsonParser p = createParser(mode, "[ "+value+" ]");
assertEquals(JsonToken.START_ARRAY, p.nextToken());
try {
try (JsonParser p = createParser(mode, "[ "+value+" ]")) {
assertEquals(JsonToken.START_ARRAY, p.nextToken());
JsonToken t = p.nextToken();
Double v = p.getDoubleValue();
fail("Should have gotten an exception for '"+value+"'; instead got ("+t+") number: "+v);
} catch (JsonParseException e) {
verifyException(e, "expected ");
}
p.close();
}

private void _testNonRootMangledInts(int mode) throws Exception {
Expand Down

0 comments on commit 0beb6fd

Please sign in to comment.