Skip to content

Commit 3f335a0

Browse files
committed
added NotSchema#describePropertiesTo()
1 parent 0bc2c6d commit 3f335a0

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

core/src/main/java/org/everit/json/schema/NotSchema.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package org.everit.json.schema;
1717

18+
import org.everit.json.schema.internal.JSONPrinter;
19+
1820
import java.util.Objects;
1921

2022
/**
@@ -86,4 +88,10 @@ public int hashCode() {
8688
protected boolean canEqual(Object other) {
8789
return other instanceof NotSchema;
8890
}
91+
92+
@Override
93+
void describePropertiesTo(JSONPrinter writer) {
94+
writer.key("not");
95+
mustNotMatch.describeTo(writer);
96+
}
8997
}

core/src/test/java/org/everit/json/schema/NotSchemaTest.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
import static org.junit.Assert.assertEquals;
2121
import org.junit.Test;
2222

23-
public class
24-
NotSchemaTest {
23+
public class NotSchemaTest {
2524

2625
@Test
2726
public void failure() {
@@ -45,4 +44,13 @@ public void equalsVerifier() {
4544
.verify();
4645
}
4746

47+
@Test
48+
public void toStringTest() {
49+
NotSchema subject = NotSchema.builder()
50+
.mustNotMatch(BooleanSchema.INSTANCE)
51+
.build();
52+
String actual = subject.toString();
53+
assertEquals("{\"not\":{\"type\":\"boolean\"}}", actual);
54+
}
55+
4856
}

0 commit comments

Comments
 (0)