Skip to content

Commit

Permalink
Add missing name-length check in a test
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Oct 26, 2023
1 parent 97030b9 commit ce0e92e
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@ public void testOverride() {
final int numLen = 1234;
final int strLen = 12345;
final int depth = 123;
final int nameLen = 2000;
StreamReadConstraints constraints = StreamReadConstraints.builder()
.maxDocumentLength(maxDocLen)
.maxNumberLength(numLen)
.maxStringLength(strLen)
.maxNameLength(nameLen)
.maxNestingDepth(depth)
.build();
try {
StreamReadConstraints.overrideDefaultStreamReadConstraints(constraints);
assertEquals(maxDocLen, StreamReadConstraints.defaults().getMaxDocumentLength());
assertEquals(depth, StreamReadConstraints.defaults().getMaxNestingDepth());
assertEquals(strLen, StreamReadConstraints.defaults().getMaxStringLength());
assertEquals(nameLen, StreamReadConstraints.defaults().getMaxNameLength());
assertEquals(numLen, StreamReadConstraints.defaults().getMaxNumberLength());
} finally {
StreamReadConstraints.overrideDefaultStreamReadConstraints(null);
Expand All @@ -34,6 +37,8 @@ public void testOverride() {
StreamReadConstraints.defaults().getMaxNestingDepth());
assertEquals(StreamReadConstraints.DEFAULT_MAX_STRING_LEN,
StreamReadConstraints.defaults().getMaxStringLength());
assertEquals(StreamReadConstraints.DEFAULT_MAX_NAME_LEN,
StreamReadConstraints.defaults().getMaxNameLength());
assertEquals(StreamReadConstraints.DEFAULT_MAX_NUM_LEN,
StreamReadConstraints.defaults().getMaxNumberLength());
}
Expand Down

0 comments on commit ce0e92e

Please sign in to comment.