Skip to content

Commit 10918c3

Browse files
committed
Merge branch 'feat/openrpc-validation-tests' of github.com:simbo1905/java.util.json.Java21 into feat/openrpc-validation-tests
2 parents 06d73f5 + 2c48b8a commit 10918c3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

json-java21-schema/src/test/java/io/github/simbo1905/json/schema/JsonSchemaRemoteServerRefTest.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@ void resolves_pointer_inside_remote_doc_via_http() {
2525
}
2626

2727
@Test
28-
void remote_cycle_logs_error_taxonomy() {
28+
void remote_cycle_handles_gracefully() {
2929
var policy = JsonSchema.FetchPolicy.defaults().withAllowedSchemes(Set.of("http","https"));
3030
var options = JsonSchema.CompileOptions.remoteDefaults(new VirtualThreadHttpFetcher()).withFetchPolicy(policy);
31-
try (CapturedLogs logs = captureLogs(java.util.logging.Level.SEVERE)) {
32-
try { JsonSchema.compile(Json.parse("{\"$ref\":\"" + SERVER.url("/cycle1.json") + "#\"}"), JsonSchema.Options.DEFAULT, options); } catch (RuntimeException ignored) {}
33-
assertThat(logs.lines().stream().anyMatch(s -> s.startsWith("ERROR: CYCLE:"))).isTrue();
34-
}
31+
32+
// Compilation should succeed despite the cycle
33+
var compiled = JsonSchema.compile(Json.parse("{\"$ref\":\"" + SERVER.url("/cycle1.json") + "#\"}"), JsonSchema.Options.DEFAULT, options);
34+
35+
// Validation should succeed by gracefully handling the cycle
36+
var result = compiled.validate(Json.parse("\"test\""));
37+
assertThat(result.valid()).isTrue();
3538
}
3639
}
3740

0 commit comments

Comments
 (0)