@@ -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