33import jdk .sandbox .java .util .json .Json ;
44import org .junit .jupiter .api .Test ;
55import org .junit .jupiter .api .AfterAll ;
6+ import org .junit .jupiter .api .AfterEach ;
67import org .junit .jupiter .api .BeforeAll ;
78
89import 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 it’ s 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