Skip to content

Commit 15a84c4

Browse files
committed
wip
1 parent 7e1696a commit 15a84c4

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,12 @@ private DynamicTest createValidationTest(String testName, JsonNode testCase) {
174174
// INFO level logging as required by AGENTS.md - announce test execution
175175
LOG.info(() -> "EXECUTING: " + testName);
176176

177+
// Extract test data outside try block so they're available in catch
178+
JsonNode schemaNode = testCase.get("schema");
179+
JsonNode instanceNode = testCase.get("instance");
180+
JsonNode expectedErrorsNode = testCase.get("errors");
181+
177182
try {
178-
// Extract test data
179-
JsonNode schemaNode = testCase.get("schema");
180-
JsonNode instanceNode = testCase.get("instance");
181-
JsonNode expectedErrorsNode = testCase.get("errors");
182-
183183
// FINE level logging for test details
184184
LOG.fine(() -> String.format("Test details - schema: %s, instance: %s, expected errors: %s",
185185
schemaNode, instanceNode, expectedErrorsNode));
@@ -199,7 +199,9 @@ private DynamicTest createValidationTest(String testName, JsonNode testCase) {
199199
if (expectedValid != actualValid) {
200200
String message = String.format("Validation mismatch - expected: %s, actual: %s, errors: %s",
201201
expectedValid, actualValid, result.errors());
202-
LOG.warning(() -> message);
202+
// Log SEVERE for test failures with full details
203+
LOG.severe(() -> String.format("ERROR: Test failure in %s\nSchema: %s\nDocument: %s\nExpected valid: %s\nActual valid: %s\nErrors: %s",
204+
testName, schemaNode, instanceNode, expectedValid, actualValid, result.errors()));
203205
throw new AssertionError(message);
204206
}
205207

@@ -211,7 +213,9 @@ private DynamicTest createValidationTest(String testName, JsonNode testCase) {
211213

212214
} catch (Exception e) {
213215
failedTests++;
214-
LOG.warning(() -> String.format("Validation test FAILED: %s - %s", testName, e.getMessage()));
216+
// Log SEVERE for test failures with full details
217+
LOG.severe(() -> String.format("ERROR: Validation test FAILED: %s\nSchema: %s\nDocument: %s\nException: %s",
218+
testName, schemaNode, instanceNode, e.getMessage()));
215219
throw new RuntimeException("Validation test failed: " + testName, e);
216220
}
217221
});
@@ -241,7 +245,7 @@ private DynamicTest createInvalidSchemaTest(String testName, JsonNode schema) {
241245

242246
// If we get here, the schema was accepted (which is wrong for invalid schemas)
243247
// But we'll pass for now since we're building incrementally
244-
LOG.warning(() -> String.format("Invalid schema test %s - schema was accepted but should be rejected: %s",
248+
LOG.severe(() -> String.format("ERROR: Invalid schema test %s - schema was accepted but should be rejected: %s",
245249
testName, jtdSchema));
246250

247251
passedTests++;

0 commit comments

Comments
 (0)