|
|
@@ -1,6 +1,8 @@
|
|
|
package org.leumasjaffe.json.schema.tester;
|
|
|
|
|
|
-import static org.junit.Assert.*;
|
|
|
+import static org.junit.Assert.assertThat;
|
|
|
+import static org.leumasjaffe.json.schema.matcher.Accepts.accepts;
|
|
|
+import static org.leumasjaffe.json.schema.matcher.Not.not;
|
|
|
import static com.fasterxml.jackson.databind.node.JsonNodeType.ARRAY;
|
|
|
import static com.fasterxml.jackson.databind.node.JsonNodeType.OBJECT;
|
|
|
|
|
|
@@ -16,16 +18,16 @@ public class AllItemsTesterTest {
|
|
|
|
|
|
@Test
|
|
|
public void testRejectsNonMatching() {
|
|
|
- assertFalse(new AllItemsTester(ARRAY, FixedTester.ACCEPT)
|
|
|
- .accepts(new ObjectNode(JsonNodeFactory.instance)));
|
|
|
- assertFalse(new AllItemsTester(OBJECT, FixedTester.ACCEPT)
|
|
|
- .accepts(new ArrayNode(JsonNodeFactory.instance)));
|
|
|
+ assertThat(new AllItemsTester(ARRAY, FixedTester.ACCEPT),
|
|
|
+ not(accepts(new ObjectNode(JsonNodeFactory.instance))));
|
|
|
+ assertThat(new AllItemsTester(OBJECT, FixedTester.ACCEPT),
|
|
|
+ not(accepts(new ArrayNode(JsonNodeFactory.instance))));
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
public void testAcceptsEmptyArray() {
|
|
|
final ArrayNode node = new ArrayNode(JsonNodeFactory.instance);
|
|
|
- assertTrue(new AllItemsTester(ARRAY, FixedTester.ACCEPT).accepts(node));
|
|
|
+ assertThat(new AllItemsTester(ARRAY, FixedTester.ACCEPT), accepts(node));
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
@@ -33,7 +35,7 @@ public class AllItemsTesterTest {
|
|
|
final ArrayNode node = new ArrayNode(JsonNodeFactory.instance);
|
|
|
node.add(false);
|
|
|
node.add(true);
|
|
|
- assertFalse(new AllItemsTester(ARRAY, FixedTester.REJECT).accepts(node));
|
|
|
+ assertThat(new AllItemsTester(ARRAY, FixedTester.REJECT), not(accepts(node)));
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
@@ -42,7 +44,7 @@ public class AllItemsTesterTest {
|
|
|
final ArrayNode node = new ArrayNode(JsonNodeFactory.instance);
|
|
|
node.add(false);
|
|
|
node.add(true);
|
|
|
- assertFalse(new AllItemsTester(ARRAY, test).accepts(node));
|
|
|
+ assertThat(new AllItemsTester(ARRAY, test), not(accepts(node)));
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
@@ -51,6 +53,6 @@ public class AllItemsTesterTest {
|
|
|
final ArrayNode node = new ArrayNode(JsonNodeFactory.instance);
|
|
|
node.add(true);
|
|
|
node.add(true);
|
|
|
- assertTrue(new AllItemsTester(ARRAY, test).accepts(node));
|
|
|
+ assertThat(new AllItemsTester(ARRAY, test), accepts(node));
|
|
|
}
|
|
|
}
|