|
|
|
@ -2,6 +2,7 @@ package com.jayway.jsonassert.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.jayway.jsonassert.JsonAsserter; |
|
|
|
|
import com.jayway.jsonpath.InvalidPathException; |
|
|
|
|
import com.jayway.jsonpath.JsonPath; |
|
|
|
|
import org.hamcrest.Matcher; |
|
|
|
|
|
|
|
|
@ -53,10 +54,11 @@ public class JsonAsserterImpl implements JsonAsserter {
|
|
|
|
|
* {@inheritDoc} |
|
|
|
|
*/ |
|
|
|
|
public JsonAsserter assertNotDefined(String path) { |
|
|
|
|
Object o = JsonPath.read(jsonObject, path); |
|
|
|
|
|
|
|
|
|
if (o != null) { |
|
|
|
|
try { |
|
|
|
|
Object o = JsonPath.read(jsonObject, path); |
|
|
|
|
throw new AssertionError(format("Document contains the path <%s> but was expected not to.", path)); |
|
|
|
|
} catch (InvalidPathException e) { |
|
|
|
|
} |
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|