|
|
|
@ -17,7 +17,6 @@
|
|
|
|
|
package org.springframework.boot.test.json;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
@ -67,28 +66,22 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public JsonContentAssert isEqualTo(Object expected) {
|
|
|
|
|
try {
|
|
|
|
|
if (expected == null || expected instanceof CharSequence) {
|
|
|
|
|
return isEqualToJson((CharSequence) expected);
|
|
|
|
|
}
|
|
|
|
|
if (expected instanceof byte[]) {
|
|
|
|
|
return isEqualToJson((byte[]) expected);
|
|
|
|
|
}
|
|
|
|
|
if (expected instanceof File) {
|
|
|
|
|
return isEqualToJson((File) expected);
|
|
|
|
|
}
|
|
|
|
|
if (expected instanceof InputStream) {
|
|
|
|
|
return isEqualToJson((InputStream) expected);
|
|
|
|
|
}
|
|
|
|
|
if (expected instanceof Resource) {
|
|
|
|
|
return isEqualToJson((Resource) expected);
|
|
|
|
|
}
|
|
|
|
|
throw new AssertionError(
|
|
|
|
|
"Unsupport type for JSON assert " + expected.getClass());
|
|
|
|
|
if (expected == null || expected instanceof CharSequence) {
|
|
|
|
|
return isEqualToJson((CharSequence) expected);
|
|
|
|
|
}
|
|
|
|
|
catch (IOException ex) {
|
|
|
|
|
throw new IllegalStateException(ex);
|
|
|
|
|
if (expected instanceof byte[]) {
|
|
|
|
|
return isEqualToJson((byte[]) expected);
|
|
|
|
|
}
|
|
|
|
|
if (expected instanceof File) {
|
|
|
|
|
return isEqualToJson((File) expected);
|
|
|
|
|
}
|
|
|
|
|
if (expected instanceof InputStream) {
|
|
|
|
|
return isEqualToJson((InputStream) expected);
|
|
|
|
|
}
|
|
|
|
|
if (expected instanceof Resource) {
|
|
|
|
|
return isEqualToJson((Resource) expected);
|
|
|
|
|
}
|
|
|
|
|
throw new AssertionError("Unsupport type for JSON assert " + expected.getClass());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -99,10 +92,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param expected the expected JSON or the name of a resource containing the expected
|
|
|
|
|
* JSON
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isEqualToJson(CharSequence expected) throws IOException {
|
|
|
|
|
public JsonContentAssert isEqualToJson(CharSequence expected) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, JSONCompareMode.LENIENT));
|
|
|
|
|
}
|
|
|
|
@ -113,11 +106,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param path the name of a resource containing the expected JSON
|
|
|
|
|
* @param resourceLoadClass the source class used to load the resource
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isEqualToJson(String path, Class<?> resourceLoadClass)
|
|
|
|
|
throws IOException {
|
|
|
|
|
public JsonContentAssert isEqualToJson(String path, Class<?> resourceLoadClass) {
|
|
|
|
|
String expectedJson = this.loader.getJson(path, resourceLoadClass);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, JSONCompareMode.LENIENT));
|
|
|
|
|
}
|
|
|
|
@ -127,10 +119,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* to the specified JSON bytes.
|
|
|
|
|
* @param expected the expected JSON bytes
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isEqualToJson(byte[] expected) throws IOException {
|
|
|
|
|
public JsonContentAssert isEqualToJson(byte[] expected) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, JSONCompareMode.LENIENT));
|
|
|
|
|
}
|
|
|
|
@ -140,10 +132,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* to the specified JSON file.
|
|
|
|
|
* @param expected a file containing the expected JSON
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isEqualToJson(File expected) throws IOException {
|
|
|
|
|
public JsonContentAssert isEqualToJson(File expected) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, JSONCompareMode.LENIENT));
|
|
|
|
|
}
|
|
|
|
@ -153,10 +145,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* to the specified JSON input stream.
|
|
|
|
|
* @param expected an input stream containing the expected JSON
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isEqualToJson(InputStream expected) throws IOException {
|
|
|
|
|
public JsonContentAssert isEqualToJson(InputStream expected) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, JSONCompareMode.LENIENT));
|
|
|
|
|
}
|
|
|
|
@ -166,10 +158,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* to the specified JSON resource.
|
|
|
|
|
* @param expected a resource containing the expected JSON
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isEqualToJson(Resource expected) throws IOException {
|
|
|
|
|
public JsonContentAssert isEqualToJson(Resource expected) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, JSONCompareMode.LENIENT));
|
|
|
|
|
}
|
|
|
|
@ -182,11 +174,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param expected the expected JSON or the name of a resource containing the expected
|
|
|
|
|
* JSON
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isStrictlyEqualToJson(CharSequence expected)
|
|
|
|
|
throws IOException {
|
|
|
|
|
public JsonContentAssert isStrictlyEqualToJson(CharSequence expected) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, JSONCompareMode.STRICT));
|
|
|
|
|
}
|
|
|
|
@ -197,11 +188,11 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param path the name of a resource containing the expected JSON
|
|
|
|
|
* @param resourceLoadClass the source class used to load the resource
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isStrictlyEqualToJson(String path,
|
|
|
|
|
Class<?> resourceLoadClass) throws IOException {
|
|
|
|
|
Class<?> resourceLoadClass) {
|
|
|
|
|
String expectedJson = this.loader.getJson(path, resourceLoadClass);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, JSONCompareMode.STRICT));
|
|
|
|
|
}
|
|
|
|
@ -211,10 +202,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* the specified JSON bytes.
|
|
|
|
|
* @param expected the expected JSON bytes
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isStrictlyEqualToJson(byte[] expected) throws IOException {
|
|
|
|
|
public JsonContentAssert isStrictlyEqualToJson(byte[] expected) {
|
|
|
|
|
return assertNotFailed(
|
|
|
|
|
compare(this.loader.getJson(expected), JSONCompareMode.STRICT));
|
|
|
|
|
}
|
|
|
|
@ -224,10 +215,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* the specified JSON file.
|
|
|
|
|
* @param expected a file containing the expected JSON
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isStrictlyEqualToJson(File expected) throws IOException {
|
|
|
|
|
public JsonContentAssert isStrictlyEqualToJson(File expected) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, JSONCompareMode.STRICT));
|
|
|
|
|
}
|
|
|
|
@ -237,11 +228,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* the specified JSON input stream.
|
|
|
|
|
* @param expected an input stream containing the expected JSON
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isStrictlyEqualToJson(InputStream expected)
|
|
|
|
|
throws IOException {
|
|
|
|
|
public JsonContentAssert isStrictlyEqualToJson(InputStream expected) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, JSONCompareMode.STRICT));
|
|
|
|
|
}
|
|
|
|
@ -251,10 +241,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* the specified JSON resource.
|
|
|
|
|
* @param expected a resource containing the expected JSON
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isStrictlyEqualToJson(Resource expected) throws IOException {
|
|
|
|
|
public JsonContentAssert isStrictlyEqualToJson(Resource expected) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, JSONCompareMode.STRICT));
|
|
|
|
|
}
|
|
|
|
@ -267,11 +257,11 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* JSON
|
|
|
|
|
* @param compareMode the compare mode used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isEqualToJson(CharSequence expected,
|
|
|
|
|
JSONCompareMode compareMode) throws IOException {
|
|
|
|
|
JSONCompareMode compareMode) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, compareMode));
|
|
|
|
|
}
|
|
|
|
@ -282,11 +272,11 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param resourceLoadClass the source class used to load the resource
|
|
|
|
|
* @param compareMode the compare mode used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isEqualToJson(String path, Class<?> resourceLoadClass,
|
|
|
|
|
JSONCompareMode compareMode) throws IOException {
|
|
|
|
|
JSONCompareMode compareMode) {
|
|
|
|
|
String expectedJson = this.loader.getJson(path, resourceLoadClass);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, compareMode));
|
|
|
|
|
}
|
|
|
|
@ -296,11 +286,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param expected the expected JSON bytes
|
|
|
|
|
* @param compareMode the compare mode used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isEqualToJson(byte[] expected, JSONCompareMode compareMode)
|
|
|
|
|
throws IOException {
|
|
|
|
|
public JsonContentAssert isEqualToJson(byte[] expected, JSONCompareMode compareMode) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, compareMode));
|
|
|
|
|
}
|
|
|
|
@ -310,11 +299,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param expected a file containing the expected JSON
|
|
|
|
|
* @param compareMode the compare mode used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isEqualToJson(File expected, JSONCompareMode compareMode)
|
|
|
|
|
throws IOException {
|
|
|
|
|
public JsonContentAssert isEqualToJson(File expected, JSONCompareMode compareMode) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, compareMode));
|
|
|
|
|
}
|
|
|
|
@ -324,11 +312,11 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param expected an input stream containing the expected JSON
|
|
|
|
|
* @param compareMode the compare mode used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isEqualToJson(InputStream expected,
|
|
|
|
|
JSONCompareMode compareMode) throws IOException {
|
|
|
|
|
JSONCompareMode compareMode) {
|
|
|
|
|
return assertNotFailed(compare(this.loader.getJson(expected), compareMode));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -337,11 +325,11 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param expected a resource containing the expected JSON
|
|
|
|
|
* @param compareMode the compare mode used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isEqualToJson(Resource expected, JSONCompareMode compareMode)
|
|
|
|
|
throws IOException {
|
|
|
|
|
public JsonContentAssert isEqualToJson(Resource expected,
|
|
|
|
|
JSONCompareMode compareMode) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, compareMode));
|
|
|
|
|
}
|
|
|
|
@ -354,11 +342,11 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* JSON
|
|
|
|
|
* @param comparator the comparator used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isEqualToJson(CharSequence expected,
|
|
|
|
|
JSONComparator comparator) throws IOException {
|
|
|
|
|
JSONComparator comparator) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, comparator));
|
|
|
|
|
}
|
|
|
|
@ -369,11 +357,11 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param resourceLoadClass the source class used to load the resource
|
|
|
|
|
* @param comparator the comparator used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isEqualToJson(String path, Class<?> resourceLoadClass,
|
|
|
|
|
JSONComparator comparator) throws IOException {
|
|
|
|
|
JSONComparator comparator) {
|
|
|
|
|
String expectedJson = this.loader.getJson(path, resourceLoadClass);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, comparator));
|
|
|
|
|
}
|
|
|
|
@ -383,11 +371,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param expected the expected JSON bytes
|
|
|
|
|
* @param comparator the comparator used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isEqualToJson(byte[] expected, JSONComparator comparator)
|
|
|
|
|
throws IOException {
|
|
|
|
|
public JsonContentAssert isEqualToJson(byte[] expected, JSONComparator comparator) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, comparator));
|
|
|
|
|
}
|
|
|
|
@ -397,11 +384,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param expected a file containing the expected JSON
|
|
|
|
|
* @param comparator the comparator used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isEqualToJson(File expected, JSONComparator comparator)
|
|
|
|
|
throws IOException {
|
|
|
|
|
public JsonContentAssert isEqualToJson(File expected, JSONComparator comparator) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, comparator));
|
|
|
|
|
}
|
|
|
|
@ -411,11 +397,11 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param expected an input stream containing the expected JSON
|
|
|
|
|
* @param comparator the comparator used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isEqualToJson(InputStream expected,
|
|
|
|
|
JSONComparator comparator) throws IOException {
|
|
|
|
|
JSONComparator comparator) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, comparator));
|
|
|
|
|
}
|
|
|
|
@ -425,11 +411,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param expected a resource containing the expected JSON
|
|
|
|
|
* @param comparator the comparator used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is not equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isEqualToJson(Resource expected, JSONComparator comparator)
|
|
|
|
|
throws IOException {
|
|
|
|
|
public JsonContentAssert isEqualToJson(Resource expected, JSONComparator comparator) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotFailed(compare(expectedJson, comparator));
|
|
|
|
|
}
|
|
|
|
@ -441,28 +426,22 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public JsonContentAssert isNotEqualTo(Object expected) {
|
|
|
|
|
try {
|
|
|
|
|
if (expected == null || expected instanceof CharSequence) {
|
|
|
|
|
return isNotEqualToJson((CharSequence) expected);
|
|
|
|
|
}
|
|
|
|
|
if (expected instanceof byte[]) {
|
|
|
|
|
return isNotEqualToJson((byte[]) expected);
|
|
|
|
|
}
|
|
|
|
|
if (expected instanceof File) {
|
|
|
|
|
return isNotEqualToJson((File) expected);
|
|
|
|
|
}
|
|
|
|
|
if (expected instanceof InputStream) {
|
|
|
|
|
return isNotEqualToJson((InputStream) expected);
|
|
|
|
|
}
|
|
|
|
|
if (expected instanceof Resource) {
|
|
|
|
|
return isNotEqualToJson((Resource) expected);
|
|
|
|
|
}
|
|
|
|
|
throw new AssertionError(
|
|
|
|
|
"Unsupport type for JSON assert " + expected.getClass());
|
|
|
|
|
if (expected == null || expected instanceof CharSequence) {
|
|
|
|
|
return isNotEqualToJson((CharSequence) expected);
|
|
|
|
|
}
|
|
|
|
|
if (expected instanceof byte[]) {
|
|
|
|
|
return isNotEqualToJson((byte[]) expected);
|
|
|
|
|
}
|
|
|
|
|
if (expected instanceof File) {
|
|
|
|
|
return isNotEqualToJson((File) expected);
|
|
|
|
|
}
|
|
|
|
|
if (expected instanceof InputStream) {
|
|
|
|
|
return isNotEqualToJson((InputStream) expected);
|
|
|
|
|
}
|
|
|
|
|
catch (IOException ex) {
|
|
|
|
|
throw new IllegalStateException(ex);
|
|
|
|
|
if (expected instanceof Resource) {
|
|
|
|
|
return isNotEqualToJson((Resource) expected);
|
|
|
|
|
}
|
|
|
|
|
throw new AssertionError("Unsupport type for JSON assert " + expected.getClass());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -473,10 +452,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param expected the expected JSON or the name of a resource containing the expected
|
|
|
|
|
* JSON
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(CharSequence expected) throws IOException {
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(CharSequence expected) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, JSONCompareMode.LENIENT));
|
|
|
|
|
}
|
|
|
|
@ -487,11 +466,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param path the name of a resource containing the expected JSON
|
|
|
|
|
* @param resourceLoadClass the source class used to load the resource
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(String path, Class<?> resourceLoadClass)
|
|
|
|
|
throws IOException {
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(String path, Class<?> resourceLoadClass) {
|
|
|
|
|
String expectedJson = this.loader.getJson(path, resourceLoadClass);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, JSONCompareMode.LENIENT));
|
|
|
|
|
}
|
|
|
|
@ -501,10 +479,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* equal to the specified JSON bytes.
|
|
|
|
|
* @param expected the expected JSON bytes
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(byte[] expected) throws IOException {
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(byte[] expected) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, JSONCompareMode.LENIENT));
|
|
|
|
|
}
|
|
|
|
@ -514,10 +492,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* equal to the specified JSON file.
|
|
|
|
|
* @param expected a file containing the expected JSON
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(File expected) throws IOException {
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(File expected) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, JSONCompareMode.LENIENT));
|
|
|
|
|
}
|
|
|
|
@ -527,10 +505,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* equal to the specified JSON input stream.
|
|
|
|
|
* @param expected an input stream containing the expected JSON
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(InputStream expected) throws IOException {
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(InputStream expected) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, JSONCompareMode.LENIENT));
|
|
|
|
|
}
|
|
|
|
@ -540,10 +518,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* equal to the specified JSON resource.
|
|
|
|
|
* @param expected a resource containing the expected JSON
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(Resource expected) throws IOException {
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(Resource expected) {
|
|
|
|
|
return assertNotPassed(
|
|
|
|
|
compare(this.loader.getJson(expected), JSONCompareMode.LENIENT));
|
|
|
|
|
}
|
|
|
|
@ -556,11 +534,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param expected the expected JSON or the name of a resource containing the expected
|
|
|
|
|
* JSON
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotStrictlyEqualToJson(CharSequence expected)
|
|
|
|
|
throws IOException {
|
|
|
|
|
public JsonContentAssert isNotStrictlyEqualToJson(CharSequence expected) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, JSONCompareMode.STRICT));
|
|
|
|
|
}
|
|
|
|
@ -571,11 +548,11 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param path the name of a resource containing the expected JSON
|
|
|
|
|
* @param resourceLoadClass the source class used to load the resource
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotStrictlyEqualToJson(String path,
|
|
|
|
|
Class<?> resourceLoadClass) throws IOException {
|
|
|
|
|
Class<?> resourceLoadClass) {
|
|
|
|
|
String expectedJson = this.loader.getJson(path, resourceLoadClass);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, JSONCompareMode.STRICT));
|
|
|
|
|
}
|
|
|
|
@ -585,11 +562,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* to the specified JSON bytes.
|
|
|
|
|
* @param expected the expected JSON bytes
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotStrictlyEqualToJson(byte[] expected)
|
|
|
|
|
throws IOException {
|
|
|
|
|
public JsonContentAssert isNotStrictlyEqualToJson(byte[] expected) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, JSONCompareMode.STRICT));
|
|
|
|
|
}
|
|
|
|
@ -599,10 +575,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* to the specified JSON file.
|
|
|
|
|
* @param expected a file containing the expected JSON
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotStrictlyEqualToJson(File expected) throws IOException {
|
|
|
|
|
public JsonContentAssert isNotStrictlyEqualToJson(File expected) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, JSONCompareMode.STRICT));
|
|
|
|
|
}
|
|
|
|
@ -612,11 +588,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* to the specified JSON input stream.
|
|
|
|
|
* @param expected an input stream containing the expected JSON
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotStrictlyEqualToJson(InputStream expected)
|
|
|
|
|
throws IOException {
|
|
|
|
|
public JsonContentAssert isNotStrictlyEqualToJson(InputStream expected) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, JSONCompareMode.STRICT));
|
|
|
|
|
}
|
|
|
|
@ -626,11 +601,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* to the specified JSON resource.
|
|
|
|
|
* @param expected a resource containing the expected JSON
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotStrictlyEqualToJson(Resource expected)
|
|
|
|
|
throws IOException {
|
|
|
|
|
public JsonContentAssert isNotStrictlyEqualToJson(Resource expected) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, JSONCompareMode.STRICT));
|
|
|
|
|
}
|
|
|
|
@ -643,11 +617,11 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* JSON
|
|
|
|
|
* @param compareMode the compare mode used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(CharSequence expected,
|
|
|
|
|
JSONCompareMode compareMode) throws IOException {
|
|
|
|
|
JSONCompareMode compareMode) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, compareMode));
|
|
|
|
|
}
|
|
|
|
@ -658,11 +632,11 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param resourceLoadClass the source class used to load the resource
|
|
|
|
|
* @param compareMode the compare mode used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(String path, Class<?> resourceLoadClass,
|
|
|
|
|
JSONCompareMode compareMode) throws IOException {
|
|
|
|
|
JSONCompareMode compareMode) {
|
|
|
|
|
String expectedJson = this.loader.getJson(path, resourceLoadClass);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, compareMode));
|
|
|
|
|
}
|
|
|
|
@ -672,11 +646,11 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param expected the expected JSON bytes
|
|
|
|
|
* @param compareMode the compare mode used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(byte[] expected,
|
|
|
|
|
JSONCompareMode compareMode) throws IOException {
|
|
|
|
|
JSONCompareMode compareMode) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, compareMode));
|
|
|
|
|
}
|
|
|
|
@ -686,11 +660,11 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param expected a file containing the expected JSON
|
|
|
|
|
* @param compareMode the compare mode used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(File expected, JSONCompareMode compareMode)
|
|
|
|
|
throws IOException {
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(File expected,
|
|
|
|
|
JSONCompareMode compareMode) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, compareMode));
|
|
|
|
|
}
|
|
|
|
@ -700,11 +674,11 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param expected an input stream containing the expected JSON
|
|
|
|
|
* @param compareMode the compare mode used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(InputStream expected,
|
|
|
|
|
JSONCompareMode compareMode) throws IOException {
|
|
|
|
|
JSONCompareMode compareMode) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, compareMode));
|
|
|
|
|
}
|
|
|
|
@ -714,11 +688,11 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param expected a resource containing the expected JSON
|
|
|
|
|
* @param compareMode the compare mode used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(Resource expected,
|
|
|
|
|
JSONCompareMode compareMode) throws IOException {
|
|
|
|
|
JSONCompareMode compareMode) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, compareMode));
|
|
|
|
|
}
|
|
|
|
@ -731,11 +705,11 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* JSON
|
|
|
|
|
* @param comparator the comparator used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(CharSequence expected,
|
|
|
|
|
JSONComparator comparator) throws IOException {
|
|
|
|
|
JSONComparator comparator) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, comparator));
|
|
|
|
|
}
|
|
|
|
@ -746,11 +720,11 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param resourceLoadClass the source class used to load the resource
|
|
|
|
|
* @param comparator the comparator used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(String path, Class<?> resourceLoadClass,
|
|
|
|
|
JSONComparator comparator) throws IOException {
|
|
|
|
|
JSONComparator comparator) {
|
|
|
|
|
String expectedJson = this.loader.getJson(path, resourceLoadClass);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, comparator));
|
|
|
|
|
}
|
|
|
|
@ -760,11 +734,11 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param expected the expected JSON bytes
|
|
|
|
|
* @param comparator the comparator used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(byte[] expected, JSONComparator comparator)
|
|
|
|
|
throws IOException {
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(byte[] expected,
|
|
|
|
|
JSONComparator comparator) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, comparator));
|
|
|
|
|
}
|
|
|
|
@ -774,11 +748,10 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param expected a file containing the expected JSON
|
|
|
|
|
* @param comparator the comparator used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(File expected, JSONComparator comparator)
|
|
|
|
|
throws IOException {
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(File expected, JSONComparator comparator) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, comparator));
|
|
|
|
|
}
|
|
|
|
@ -788,11 +761,11 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param expected an input stream containing the expected JSON
|
|
|
|
|
* @param comparator the comparator used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(InputStream expected,
|
|
|
|
|
JSONComparator comparator) throws IOException {
|
|
|
|
|
JSONComparator comparator) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, comparator));
|
|
|
|
|
}
|
|
|
|
@ -802,11 +775,11 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
|
|
|
|
* @param expected a resource containing the expected JSON
|
|
|
|
|
* @param comparator the comparator used when checking
|
|
|
|
|
* @return {@code this} assertion object
|
|
|
|
|
* @throws IOException on IO error
|
|
|
|
|
* @on IO error
|
|
|
|
|
* @throws AssertionError if the actual JSON value is equal to the given one
|
|
|
|
|
*/
|
|
|
|
|
public JsonContentAssert isNotEqualToJson(Resource expected,
|
|
|
|
|
JSONComparator comparator) throws IOException {
|
|
|
|
|
JSONComparator comparator) {
|
|
|
|
|
String expectedJson = this.loader.getJson(expected);
|
|
|
|
|
return assertNotPassed(compare(expectedJson, comparator));
|
|
|
|
|
}
|
|
|
|
|