Skip to content

Commit 01af197

Browse files
committed
adding violated keyword to NotSchema and NullSchema
1 parent 5ebdd88 commit 01af197

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ public void validate(final Object subject) {
5959
} catch (ValidationException e) {
6060
return;
6161
}
62-
throw new ValidationException(this, "subject must not be valid agains schema " + mustNotMatch);
62+
throw new ValidationException(this, "subject must not be valid agains schema " + mustNotMatch,
63+
"not");
6364
}
6465

6566
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public NullSchema(final Builder builder) {
4747
public void validate(final Object subject) {
4848
if (!(subject == null || subject == JSONObject.NULL)) {
4949
throw new ValidationException(this, "expected: null, found: "
50-
+ subject.getClass().getSimpleName());
50+
+ subject.getClass().getSimpleName(), "type");
5151
}
5252
}
5353

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ public class NotSchemaTest {
2222
@Test
2323
public void failure() {
2424
NotSchema subject = NotSchema.builder().mustNotMatch(BooleanSchema.INSTANCE).build();
25-
TestSupport.expectFailure(subject, true);
25+
TestSupport.failureOf(subject)
26+
.input(true)
27+
.expectedKeyword("not")
28+
.expect();
2629
}
2730

2831
@Test

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ public class NullSchemaTest {
2222

2323
@Test
2424
public void failure() {
25-
TestSupport.expectFailure(NullSchema.INSTANCE, "null");
25+
TestSupport.failureOf(NullSchema.INSTANCE)
26+
.expectedKeyword("type")
27+
.input("null")
28+
.expect();
2629
}
2730

2831
@Test

0 commit comments

Comments
 (0)