1515import java .nio .file .Paths ;
1616import java .util .zip .ZipEntry ;
1717import java .util .zip .ZipInputStream ;
18- import java .util .concurrent .ConcurrentHashMap ;
1918import java .util .stream .Stream ;
2019import java .util .stream .StreamSupport ;
2120
2524/// By default, this is lenient and will SKIP mismatches and unsupported schemas
2625/// to provide a compatibility signal without breaking the build. Enable strict
2726/// mode with -Djson.schema.strict=true to make mismatches fail the build.
28- /// Test data location: see src/test/resources/JSONSchemaTestSuite-20250921/DOWNLOAD_COMMANDS.md
29- public class JsonSchemaCheckIT {
27+ public class JsonSchemaCheck202012IT {
3028
3129 private static final Path ZIP_FILE = Paths .get ("src/test/resources/json-schema-test-suite-data.zip" );
3230 private static final Path TARGET_SUITE_DIR = Paths .get ("target/test-data/draft2020-12" );
@@ -138,7 +136,7 @@ static Stream<DynamicTest> dynamicTestStream(Path file, JsonNode root) {
138136 perFile (file ).run .increment ();
139137 } catch (Exception e ) {
140138 final var reason = e .getMessage () == null ? e .getClass ().getSimpleName () : e .getMessage ();
141- System .err .println ("[JsonSchemaCheckIT ] Skipping test due to exception: "
139+ System .err .println ("[JsonSchemaCheck202012IT ] Skipping test due to exception: "
142140 + groupDesc + " — " + reason + " (" + file .getFileName () + ")" );
143141
144142 /// Count exception as skipped mismatch in strict metrics
@@ -163,7 +161,7 @@ static Stream<DynamicTest> dynamicTestStream(Path file, JsonNode root) {
163161 throw e ;
164162 }
165163 } else if (expected != actual ) {
166- System .err .println ("[JsonSchemaCheckIT ] Mismatch (ignored): "
164+ System .err .println ("[JsonSchemaCheck202012IT ] Mismatch (ignored): "
167165 + groupDesc + " — expected=" + expected + ", actual=" + actual
168166 + " (" + file .getFileName () + ")" );
169167
@@ -181,7 +179,7 @@ static Stream<DynamicTest> dynamicTestStream(Path file, JsonNode root) {
181179 } catch (Exception ex ) {
182180 /// Unsupported schema for this group; emit a single skipped test for visibility
183181 final var reason = ex .getMessage () == null ? ex .getClass ().getSimpleName () : ex .getMessage ();
184- System .err .println ("[JsonSchemaCheckIT ] Skipping group due to unsupported schema: "
182+ System .err .println ("[JsonSchemaCheck202012IT ] Skipping group due to unsupported schema: "
185183 + groupDesc + " — " + reason + " (" + file .getFileName () + ")" );
186184
187185 /// Count unsupported group skip
@@ -329,32 +327,3 @@ static String buildCsvSummary(boolean strict, String timestamp) {
329327 }
330328}
331329
332- /// Thread-safe metrics container for the JSON Schema Test Suite run.
333- /// Thread-safe strict metrics container for the JSON Schema Test Suite run
334- final class StrictMetrics {
335- final java .util .concurrent .atomic .LongAdder total = new java .util .concurrent .atomic .LongAdder ();
336- final java .util .concurrent .atomic .LongAdder run = new java .util .concurrent .atomic .LongAdder ();
337- final java .util .concurrent .atomic .LongAdder passed = new java .util .concurrent .atomic .LongAdder ();
338- final java .util .concurrent .atomic .LongAdder failed = new java .util .concurrent .atomic .LongAdder ();
339- final java .util .concurrent .atomic .LongAdder skippedUnsupported = new java .util .concurrent .atomic .LongAdder ();
340- final java .util .concurrent .atomic .LongAdder skippedMismatch = new java .util .concurrent .atomic .LongAdder ();
341-
342- // Legacy counters for backward compatibility
343- final java .util .concurrent .atomic .LongAdder groupsDiscovered = new java .util .concurrent .atomic .LongAdder ();
344- final java .util .concurrent .atomic .LongAdder testsDiscovered = new java .util .concurrent .atomic .LongAdder ();
345- final java .util .concurrent .atomic .LongAdder skipTestException = new java .util .concurrent .atomic .LongAdder ();
346-
347- final ConcurrentHashMap <String , FileCounters > perFile = new ConcurrentHashMap <>();
348-
349- /// Per-file counters for detailed metrics
350- static final class FileCounters {
351- final java .util .concurrent .atomic .LongAdder groups = new java .util .concurrent .atomic .LongAdder ();
352- final java .util .concurrent .atomic .LongAdder tests = new java .util .concurrent .atomic .LongAdder ();
353- final java .util .concurrent .atomic .LongAdder run = new java .util .concurrent .atomic .LongAdder ();
354- final java .util .concurrent .atomic .LongAdder pass = new java .util .concurrent .atomic .LongAdder ();
355- final java .util .concurrent .atomic .LongAdder fail = new java .util .concurrent .atomic .LongAdder ();
356- final java .util .concurrent .atomic .LongAdder skipUnsupported = new java .util .concurrent .atomic .LongAdder ();
357- final java .util .concurrent .atomic .LongAdder skipException = new java .util .concurrent .atomic .LongAdder ();
358- final java .util .concurrent .atomic .LongAdder skipMismatch = new java .util .concurrent .atomic .LongAdder ();
359- }
360- }
0 commit comments