Browse Source

changed hamcrest dependency from hamcrest-all to hamcrest-library

pull/1/merge
kalle 14 years ago
parent
commit
4e4e15f515
  1. 5
      json-path-assert/pom.xml
  2. 13
      json-path-assert/src/main/java/com/jayway/jsonassert/impl/JsonAsserterImpl.java
  3. 5
      json-path/pom.xml
  4. 7
      pom.xml

5
json-path-assert/pom.xml

@ -14,7 +14,8 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>json-path-parent</artifactId>
@ -46,7 +47,7 @@
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<artifactId>hamcrest-library</artifactId>
</dependency>
</dependencies>
</project>

13
json-path-assert/src/main/java/com/jayway/jsonassert/impl/JsonAsserterImpl.java

@ -5,7 +5,6 @@ import com.jayway.jsonassert.JsonAsserter;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.PathUtil;
import org.hamcrest.Matcher;
import org.hamcrest.MatcherAssert;
import static java.lang.String.format;
import static org.hamcrest.Matchers.*;
@ -40,9 +39,15 @@ public class JsonAsserterImpl implements JsonAsserter {
String reason = "When processing json path: " + path;
if (PathUtil.isPathDefinite(path)) {
MatcherAssert.assertThat(reason, JsonPath.<T>readOne(jsonObject, path), matcher);
if (!matcher.matches(JsonPath.<T>readOne(jsonObject, path))) {
throw new AssertionError(reason + matcher.toString());
}
//MatcherAssert.assertThat(reason, JsonPath.<T>readOne(jsonObject, path), matcher);
} else {
MatcherAssert.assertThat(reason, (T) JsonPath.<T>read(jsonObject, path), matcher);
if (!matcher.matches(JsonPath.<T>read(jsonObject, path))) {
throw new AssertionError(reason + matcher.toString());
}
//MatcherAssert.assertThat(reason, (T) JsonPath.<T>read(jsonObject, path), matcher);
}
return this;
}
@ -60,7 +65,7 @@ public class JsonAsserterImpl implements JsonAsserter {
public JsonAsserter assertNotDefined(String path) {
Object o = JsonPath.readOne(jsonObject, path);
if(o != null){
if (o != null) {
throw new AssertionError(format("Document contains the path <%s> but was expected not to.", path));
}
return this;

5
json-path/pom.xml

@ -14,7 +14,8 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.jayway.jsonpath</groupId>
@ -47,7 +48,7 @@
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>

7
pom.xml

@ -14,7 +14,8 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.oss</groupId>
@ -31,7 +32,7 @@
<inceptionYear>2011</inceptionYear>
<issueManagement>
<system>GitHub Issue Tracking</system>
<url />
<url/>
</issueManagement>
<licenses>
<license>
@ -139,7 +140,7 @@
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<artifactId>hamcrest-library</artifactId>
<version>1.1</version>
</dependency>

Loading…
Cancel
Save