diff --git a/build.gradle b/build.gradle index 52c4963f..15366590 100644 --- a/build.gradle +++ b/build.gradle @@ -12,8 +12,7 @@ buildscript { ext { libs = [ gson: 'com.google.code.gson:gson:2.8.5', - hamcrestCore: 'org.hamcrest:hamcrest-core:1.3', - hamcrestLibrary: 'org.hamcrest:hamcrest-library:1.3', + hamcrest: 'org.hamcrest:hamcrest:2.1', jacksonDatabind: 'com.fasterxml.jackson.core:jackson-databind:2.9.8', jettison: 'org.codehaus.jettison:jettison:1.3.7', jsonOrg: 'org.json:json:20140107', @@ -25,8 +24,7 @@ ext { 'commons-io:commons-io:2.4', 'junit:junit:4.12', 'org.assertj:assertj-core:3.11.1', - 'org.hamcrest:hamcrest-core:1.3', - 'org.hamcrest:hamcrest-library:1.3', + 'org.hamcrest:hamcrest:2.1', 'org.slf4j:slf4j-simple:1.7.26' ] ] diff --git a/json-path-assert/build.gradle b/json-path-assert/build.gradle index f63e70bb..8bc738c1 100644 --- a/json-path-assert/build.gradle +++ b/json-path-assert/build.gradle @@ -11,8 +11,7 @@ jar { dependencies { compile project(':json-path') - compile libs.hamcrestCore - compile libs.hamcrestLibrary + compile libs.hamcrest compile libs.slf4jApi testCompile libs.test diff --git a/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsCollectionWithSize.java b/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsCollectionWithSize.java index c4b7c1df..2a80384c 100644 --- a/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsCollectionWithSize.java +++ b/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsCollectionWithSize.java @@ -30,7 +30,6 @@ DAMAGE. package com.jayway.jsonassert.impl.matcher; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import java.util.Collection; @@ -52,6 +51,7 @@ public class IsCollectionWithSize extends CollectionMatcher extends CollectionMatcher Matcher> hasSize(Matcher size) { return new IsCollectionWithSize(size); } @@ -71,9 +70,8 @@ public class IsCollectionWithSize extends CollectionMatcher Matcher> hasSize(int size) { Matcher matcher = equalTo(size); return IsCollectionWithSize.hasSize(matcher); } -} \ No newline at end of file +} diff --git a/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsEmptyCollection.java b/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsEmptyCollection.java index 23b12d07..2f4ec211 100644 --- a/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsEmptyCollection.java +++ b/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsEmptyCollection.java @@ -30,7 +30,6 @@ DAMAGE. package com.jayway.jsonassert.impl.matcher; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import java.util.Collection; @@ -45,6 +44,7 @@ public class IsEmptyCollection extends CollectionMatcher> { return item.isEmpty(); } + @Override public void describeTo(Description description) { description.appendText("an empty collection"); } @@ -52,8 +52,7 @@ public class IsEmptyCollection extends CollectionMatcher> { /** * Matches an empty collection. */ - @Factory public static Matcher> empty() { return new IsEmptyCollection(); } -} \ No newline at end of file +} diff --git a/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsMapContainingKey.java b/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsMapContainingKey.java index 97669449..c2467168 100644 --- a/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsMapContainingKey.java +++ b/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsMapContainingKey.java @@ -30,7 +30,6 @@ DAMAGE. package com.jayway.jsonassert.impl.matcher; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import java.util.Map; @@ -54,17 +53,16 @@ public class IsMapContainingKey extends MapTypeSafeMatcher> { return false; } + @Override public void describeTo(Description description) { description.appendText("map with key ") .appendDescriptionOf(keyMatcher); } - @Factory public static Matcher> hasKey(K key) { return hasKey(equalTo(key)); } - @Factory public static Matcher> hasKey(Matcher keyMatcher) { return new IsMapContainingKey(keyMatcher); } diff --git a/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsMapContainingValue.java b/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsMapContainingValue.java index 9fb3a6d0..d60462b4 100644 --- a/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsMapContainingValue.java +++ b/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsMapContainingValue.java @@ -30,7 +30,6 @@ DAMAGE. package com.jayway.jsonassert.impl.matcher; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import java.util.Map; @@ -54,17 +53,16 @@ public class IsMapContainingValue extends MapTypeSafeMatcher>{ return false; } + @Override public void describeTo(Description description) { description.appendText("map with value ") .appendDescriptionOf(valueMatcher); } - @Factory public static Matcher> hasValue(V value) { return IsMapContainingValue.hasValue(equalTo(value)); } - @Factory public static Matcher> hasValue(Matcher valueMatcher) { return new IsMapContainingValue(valueMatcher); }