Skip to content

Commit 03a9c4e

Browse files
committed
code review feedback
1 parent 4d24932 commit 03a9c4e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

json-java21-jtd/src/test/java/json/java21/jtd/JtdExhaustiveTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class JtdExhaustiveTest extends JtdTestBase {
2424
);
2525
private static final List<String> DISCRIMINATOR_VALUES = List.of("type1", "type2", "type3");
2626
private static final List<String> ENUM_VALUES = List.of("red", "green", "blue", "yellow");
27+
private static final Random RANDOM = new Random();
2728

2829
@Provide
2930
Arbitrary<JtdTestSchema> jtdSchemas() {
@@ -162,17 +163,16 @@ private static boolean isEmptyPropertiesSchema(JtdTestSchema schema) {
162163

163164
private static JsonValue generateAnyJsonValue() {
164165
// Generate a random JSON value of any type for RFC 8927 empty schema
165-
var random = new java.util.Random();
166-
return switch (random.nextInt(7)) {
166+
return switch (RANDOM.nextInt(7)) {
167167
case 0 -> JsonNull.of();
168-
case 1 -> JsonBoolean.of(random.nextBoolean());
169-
case 2 -> JsonNumber.of(random.nextInt(100));
170-
case 3 -> JsonNumber.of(random.nextDouble());
171-
case 4 -> JsonString.of("random-string-" + random.nextInt(1000));
168+
case 1 -> JsonBoolean.of(RANDOM.nextBoolean());
169+
case 2 -> JsonNumber.of(RANDOM.nextInt(100));
170+
case 3 -> JsonNumber.of(RANDOM.nextDouble());
171+
case 4 -> JsonString.of("random-string-" + RANDOM.nextInt(1000));
172172
case 5 -> JsonArray.of(List.of(generateAnyJsonValue(), generateAnyJsonValue()));
173173
case 6 -> JsonObject.of(Map.of(
174-
"key" + random.nextInt(10), generateAnyJsonValue(),
175-
"prop" + random.nextInt(10), generateAnyJsonValue()
174+
"key" + RANDOM.nextInt(10), generateAnyJsonValue(),
175+
"prop" + RANDOM.nextInt(10), generateAnyJsonValue()
176176
));
177177
default -> JsonString.of("fallback");
178178
};

0 commit comments

Comments
 (0)