Skip to content

Commit 91367bb

Browse files
committed
fixed
1 parent 302729f commit 91367bb

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import jdk.sandbox.java.util.json.Json;
44
import org.junit.jupiter.api.Test;
55
import org.junit.jupiter.api.AfterAll;
6+
import org.junit.jupiter.api.AfterEach;
67
import org.junit.jupiter.api.BeforeAll;
78

89
import static org.assertj.core.api.Assertions.*;
@@ -11,8 +12,8 @@ class JsonSchemaFormatTest extends JsonSchemaLoggingConfig {
1112
@Test
1213
void testCommonFormats_whenAssertionOn_invalidsFail_validsPass() {
1314
// Toggle "assert formats" ON (wire however your implementation exposes it).
14-
// If you use a system property, ensure its read at compile() time.
15-
System.setProperty("json.schema.format.assert", "true");
15+
// If you use a system property, ensure it's read at compile() time.
16+
System.setProperty("jsonschema.format.assertion", "true");
1617

1718
// Invalids must FAIL when assertion is on
1819
final var uuidSchema = JsonSchema.compile(Json.parse("""
@@ -39,7 +40,7 @@ void testCommonFormats_whenAssertionOn_invalidsFail_validsPass() {
3940
@Test
4041
void testFormats_whenAssertionOff_areAnnotationsOnly() {
4142
// Toggle "assert formats" OFF (annotation-only)
42-
System.setProperty("json.schema.format.assert", "false");
43+
System.setProperty("jsonschema.format.assertion", "false");
4344

4445
final var uuidSchema = JsonSchema.compile(Json.parse("""
4546
{ "type":"string", "format":"uuid" }
@@ -336,6 +337,16 @@ static void tearDownSystemProperty() {
336337
}
337338
}
338339

340+
@AfterEach
341+
void resetSystemProperty() {
342+
// Reset to default state after each test that might change it
343+
if (originalSystemProperty != null) {
344+
System.setProperty("jsonschema.format.assertion", originalSystemProperty);
345+
} else {
346+
System.clearProperty("jsonschema.format.assertion");
347+
}
348+
}
349+
339350
@Test
340351
void testFormatAssertionSystemProperty() {
341352
/// Test format assertion via system property

0 commit comments

Comments
 (0)