diff --git a/core/pom.xml b/core/pom.xml
index d13791909..edefe080f 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -27,7 +27,7 @@
UTF-8
1.8
1.8
- 0.8.4
+ 0.8.6
everit-org/json-schema
https://github.com/everit-org/json-schema
@@ -93,7 +93,7 @@
maven-surefire-plugin
org.apache.maven.plugins
- 2.20
+ 2.22.2
${surefireArgLine}
@@ -228,9 +228,9 @@
test
- junit
- junit
- 4.12
+ org.junit.jupiter
+ junit-jupiter
+ 5.7.0
test
@@ -262,12 +262,6 @@
3.0.3
test
-
- pl.pragmatists
- JUnitParams
- 1.1.0
- test
-
com.damnhandy
handy-uri-templates
@@ -278,6 +272,12 @@
re2j
1.3
+
+ org.hamcrest
+ hamcrest-core
+ 1.3
+ test
+
diff --git a/core/src/test/java/org/everit/json/schema/ArraySchemaTest.java b/core/src/test/java/org/everit/json/schema/ArraySchemaTest.java
index 47df2bede..c59a7222f 100644
--- a/core/src/test/java/org/everit/json/schema/ArraySchemaTest.java
+++ b/core/src/test/java/org/everit/json/schema/ArraySchemaTest.java
@@ -18,11 +18,12 @@
import static org.everit.json.schema.JSONMatcher.sameJsonAs;
import static org.everit.json.schema.TestSupport.buildWithLocation;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import org.everit.json.schema.loader.SchemaLoader;
import org.json.JSONObject;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
@@ -125,10 +126,12 @@ public void nonUniqueArrayOfArrays() {
.expect();
}
- @Test(expected = SchemaException.class)
+ @Test
public void tupleAndListFailure() {
- ArraySchema.builder().addItemSchema(BooleanSchema.INSTANCE).allItemSchema(NullSchema.INSTANCE)
- .build();
+ assertThrows(SchemaException.class, () -> {
+ ArraySchema.builder().addItemSchema(BooleanSchema.INSTANCE).allItemSchema(NullSchema.INSTANCE)
+ .build();
+ });
}
@Test
diff --git a/core/src/test/java/org/everit/json/schema/BooleanSchemaTest.java b/core/src/test/java/org/everit/json/schema/BooleanSchemaTest.java
index a239f66a3..94f5ed5d2 100644
--- a/core/src/test/java/org/everit/json/schema/BooleanSchemaTest.java
+++ b/core/src/test/java/org/everit/json/schema/BooleanSchemaTest.java
@@ -17,8 +17,8 @@
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
public class BooleanSchemaTest {
@@ -37,7 +37,7 @@ public void success() {
@Test
public void toStringTest() {
- Assert.assertEquals("{\"type\":\"boolean\"}", BooleanSchema.INSTANCE.toString());
+ Assertions.assertEquals("{\"type\":\"boolean\"}", BooleanSchema.INSTANCE.toString());
}
public void equalsVerifier() {
diff --git a/core/src/test/java/org/everit/json/schema/CollectingFailureReporterTest.java b/core/src/test/java/org/everit/json/schema/CollectingFailureReporterTest.java
index 51686a929..39bb1a9f5 100644
--- a/core/src/test/java/org/everit/json/schema/CollectingFailureReporterTest.java
+++ b/core/src/test/java/org/everit/json/schema/CollectingFailureReporterTest.java
@@ -2,12 +2,10 @@
import static java.util.Arrays.asList;
import static org.everit.json.schema.ValidationException.createWrappingException;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.*;
import org.json.JSONObject;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class CollectingFailureReporterTest {
@@ -20,9 +18,11 @@ public void noNewExceptions_returnsNull() {
assertNull(actual);
}
- @Test(expected = NullPointerException.class)
+ @Test
public void subSchemaIsNull() {
- createSubject().inContextOfSchema(null, () -> {
+ assertThrows(NullPointerException.class, () -> {
+ createSubject().inContextOfSchema(null, () -> {
+ });
});
}
diff --git a/core/src/test/java/org/everit/json/schema/CombinedSchemaTest.java b/core/src/test/java/org/everit/json/schema/CombinedSchemaTest.java
index 296539ed3..0237a07c8 100644
--- a/core/src/test/java/org/everit/json/schema/CombinedSchemaTest.java
+++ b/core/src/test/java/org/everit/json/schema/CombinedSchemaTest.java
@@ -17,17 +17,16 @@
import static java.util.Arrays.asList;
import static org.everit.json.schema.JSONMatcher.sameJsonAs;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.*;
import java.util.List;
import org.json.JSONObject;
-import org.junit.Assert;
-import org.junit.Test;
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
+import org.junit.jupiter.api.Test;
public class CombinedSchemaTest {
@@ -35,9 +34,11 @@ public class CombinedSchemaTest {
NumberSchema.builder().multipleOf(10).build(),
NumberSchema.builder().multipleOf(3).build());
- @Test(expected = ValidationException.class)
+ @Test
public void allCriterionFailure() {
- CombinedSchema.ALL_CRITERION.validate(10, 1);
+ assertThrows(ValidationException.class, () -> {
+ CombinedSchema.ALL_CRITERION.validate(10, 1);
+ });
}
@Test
@@ -45,9 +46,11 @@ public void allCriterionSuccess() {
CombinedSchema.ALL_CRITERION.validate(10, 10);
}
- @Test(expected = ValidationException.class)
+ @Test
public void anyCriterionFailure() {
- CombinedSchema.ANY_CRITERION.validate(10, 0);
+ assertThrows(ValidationException.class, () -> {
+ CombinedSchema.ANY_CRITERION.validate(10, 0);
+ });
}
@Test
@@ -55,12 +58,14 @@ public void anyCriterionSuccess() {
CombinedSchema.ANY_CRITERION.validate(10, 1);
}
- @Test(expected = ValidationException.class)
+ @Test
public void anyOfInvalid() {
- CombinedSchema.anyOf(asList(
- StringSchema.builder().maxLength(2).build(),
- StringSchema.builder().minLength(4).build()))
- .build().validate("foo");
+ assertThrows(ValidationException.class, () -> {
+ CombinedSchema.anyOf(asList(
+ StringSchema.builder().maxLength(2).build(),
+ StringSchema.builder().minLength(4).build()))
+ .build().validate("foo");
+ });
}
@Test
@@ -70,9 +75,11 @@ public void factories() {
CombinedSchema.oneOf(asList(BooleanSchema.INSTANCE));
}
- @Test(expected = ValidationException.class)
+ @Test
public void oneCriterionFailure() {
- CombinedSchema.ONE_CRITERION.validate(10, 2);
+ assertThrows(ValidationException.class, () -> {
+ CombinedSchema.ONE_CRITERION.validate(10, 2);
+ });
}
@Test
@@ -108,7 +115,7 @@ public void validateOne() {
public void reportCauses() {
try {
CombinedSchema.allOf(SUBSCHEMAS).build().validate(24);
- Assert.fail("did not throw exception");
+ fail("did not throw exception");
} catch (ValidationException e) {
assertEquals(1, e.getCausingExceptions().size());
}
diff --git a/core/src/test/java/org/everit/json/schema/ConditionalSchemaEventsTest.java b/core/src/test/java/org/everit/json/schema/ConditionalSchemaEventsTest.java
index 2bab98a02..fe3cac82f 100644
--- a/core/src/test/java/org/everit/json/schema/ConditionalSchemaEventsTest.java
+++ b/core/src/test/java/org/everit/json/schema/ConditionalSchemaEventsTest.java
@@ -6,31 +6,26 @@
import static org.everit.json.schema.event.ConditionalSchemaValidationEvent.Keyword.ELSE;
import static org.everit.json.schema.event.ConditionalSchemaValidationEvent.Keyword.IF;
import static org.everit.json.schema.event.ConditionalSchemaValidationEvent.Keyword.THEN;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
+import static org.mockito.Mockito.*;
import org.everit.json.schema.event.ConditionalSchemaMatchEvent;
import org.everit.json.schema.event.ConditionalSchemaMismatchEvent;
import org.everit.json.schema.event.ValidationListener;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
-@RunWith(MockitoJUnitRunner.class)
public class ConditionalSchemaEventsTest {
private ConditionalSchema schema = ConditionalSchema.builder().ifSchema(PATTERN_STRING_SCHEMA)
.thenSchema(MIN_LENGTH_STRING_SCHEMA)
.elseSchema(MAX_LENGTH_STRING_SCHEMA).schemaLocation("#").build();
- @Mock
- ValidationListener listener;
+ ValidationListener listener = mock(ValidationListener.class);
private ValidationFailureReporter reporter;
- @Before public void before() {
+ @BeforeEach
+ public void before() {
reporter = new CollectingFailureReporter(schema);
}
diff --git a/core/src/test/java/org/everit/json/schema/ConditionalSchemaTest.java b/core/src/test/java/org/everit/json/schema/ConditionalSchemaTest.java
index 910898061..5be4adb8d 100644
--- a/core/src/test/java/org/everit/json/schema/ConditionalSchemaTest.java
+++ b/core/src/test/java/org/everit/json/schema/ConditionalSchemaTest.java
@@ -1,10 +1,10 @@
package org.everit.json.schema;
import static org.everit.json.schema.JSONMatcher.sameJsonAs;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import org.json.JSONObject;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ConditionalSchemaTest {
diff --git a/core/src/test/java/org/everit/json/schema/ConstSchemaTest.java b/core/src/test/java/org/everit/json/schema/ConstSchemaTest.java
index 54a0ecce7..1275ac2ea 100644
--- a/core/src/test/java/org/everit/json/schema/ConstSchemaTest.java
+++ b/core/src/test/java/org/everit/json/schema/ConstSchemaTest.java
@@ -1,11 +1,11 @@
package org.everit.json.schema;
import static org.everit.json.schema.TestSupport.loadAsV6;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.json.JSONArray;
import org.json.JSONObject;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ConstSchemaTest {
diff --git a/core/src/test/java/org/everit/json/schema/EarlyFailingFailureReporterTest.java b/core/src/test/java/org/everit/json/schema/EarlyFailingFailureReporterTest.java
index 608f1b839..3869c7ad4 100644
--- a/core/src/test/java/org/everit/json/schema/EarlyFailingFailureReporterTest.java
+++ b/core/src/test/java/org/everit/json/schema/EarlyFailingFailureReporterTest.java
@@ -1,9 +1,9 @@
package org.everit.json.schema;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.Test;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.fail;
public class EarlyFailingFailureReporterTest {
diff --git a/core/src/test/java/org/everit/json/schema/EmptySchemaTest.java b/core/src/test/java/org/everit/json/schema/EmptySchemaTest.java
index e293061c1..18ef805ec 100644
--- a/core/src/test/java/org/everit/json/schema/EmptySchemaTest.java
+++ b/core/src/test/java/org/everit/json/schema/EmptySchemaTest.java
@@ -15,13 +15,14 @@
*/
package org.everit.json.schema;
-import static org.junit.Assert.assertEquals;
import org.json.JSONObject;
-import org.junit.Test;
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class EmptySchemaTest {
diff --git a/core/src/test/java/org/everit/json/schema/EnumSchemaTest.java b/core/src/test/java/org/everit/json/schema/EnumSchemaTest.java
index 0467a0c1e..6647087bd 100644
--- a/core/src/test/java/org/everit/json/schema/EnumSchemaTest.java
+++ b/core/src/test/java/org/everit/json/schema/EnumSchemaTest.java
@@ -16,7 +16,7 @@
package org.everit.json.schema;
import static java.util.Arrays.asList;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.StringWriter;
import java.util.ArrayList;
@@ -28,17 +28,17 @@
import org.everit.json.schema.internal.JSONPrinter;
import org.json.JSONArray;
import org.json.JSONObject;
-import org.junit.Before;
-import org.junit.Test;
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class EnumSchemaTest {
private List