|
|
|
@ -385,102 +385,102 @@ public class JsonContentAssertTests { |
|
|
|
public void isEqualToJsonWhenStringIsMatchingAndComparatorShouldPass() |
|
|
|
public void isEqualToJsonWhenStringIsMatchingAndComparatorShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson(LENIENT_SAME, |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson(LENIENT_SAME, |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isEqualToJsonWhenStringIsNotMatchingAndComparatorShouldFail() |
|
|
|
public void isEqualToJsonWhenStringIsNotMatchingAndComparatorShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson(DIFFERENT, |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson(DIFFERENT, |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isEqualToJsonWhenResourcePathIsMatchingAndComparatorShouldPass() |
|
|
|
public void isEqualToJsonWhenResourcePathIsMatchingAndComparatorShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson("lenient-same.json", |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson("lenient-same.json", |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isEqualToJsonWhenResourcePathIsNotMatchingAndComparatorShouldFail() |
|
|
|
public void isEqualToJsonWhenResourcePathIsNotMatchingAndComparatorShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson("different.json", |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson("different.json", |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isEqualToJsonWhenResourcePathAndClassIsMatchingAndComparatorShouldPass() |
|
|
|
public void isEqualToJsonWhenResourcePathAndClassAreMatchingAndComparatorShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson("lenient-same.json", getClass(), |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson("lenient-same.json", getClass(), |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isEqualToJsonWhenResourcePathAndClassIsNotMatchingAndComparatorShouldFail() |
|
|
|
public void isEqualToJsonWhenResourcePathAndClassAreNotMatchingAndComparatorShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson("different.json", getClass(), |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson("different.json", getClass(), |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isEqualToJsonWhenBytesAreMatchingAndComparatorShouldPass() |
|
|
|
public void isEqualToJsonWhenBytesAreMatchingAndComparatorShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson(LENIENT_SAME.getBytes(), |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson(LENIENT_SAME.getBytes(), |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isEqualToJsonWhenBytesAreNotMatchingAndComparatorShouldFail() |
|
|
|
public void isEqualToJsonWhenBytesAreNotMatchingAndComparatorShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson(DIFFERENT.getBytes(), |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson(DIFFERENT.getBytes(), |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isEqualToJsonWhenFileIsMatchingAndComparatorShouldPass() |
|
|
|
public void isEqualToJsonWhenFileIsMatchingAndComparatorShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson(createFile(LENIENT_SAME), |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson(createFile(LENIENT_SAME), |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isEqualToJsonWhenFileIsNotMatchingAndComparatorShouldFail() |
|
|
|
public void isEqualToJsonWhenFileIsNotMatchingAndComparatorShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson(createFile(DIFFERENT), |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson(createFile(DIFFERENT), |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isEqualToJsonWhenInputStreamIsMatchingAndComparatorShouldPass() |
|
|
|
public void isEqualToJsonWhenInputStreamIsMatchingAndComparatorShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(LENIENT_SAME), |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(LENIENT_SAME), |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isEqualToJsonWhenInputStreamIsNotMatchingAndComparatorShouldFail() |
|
|
|
public void isEqualToJsonWhenInputStreamIsNotMatchingAndComparatorShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(DIFFERENT), |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(DIFFERENT), |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isEqualToJsonWhenResourceIsMatchingAndComparatorShouldPass() |
|
|
|
public void isEqualToJsonWhenResourceIsMatchingAndComparatorShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson(createResource(LENIENT_SAME), |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson(createResource(LENIENT_SAME), |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isEqualToJsonWhenResourceIsNotMatchingAndComparatorShouldFail() |
|
|
|
public void isEqualToJsonWhenResourceIsNotMatchingAndComparatorShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson(createResource(DIFFERENT), |
|
|
|
assertThat(forJson(SOURCE)).isEqualToJson(createResource(DIFFERENT), |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToWhenStringIsMatchingShouldPass() throws Exception { |
|
|
|
public void isNotEqualToWhenStringIsMatchingShouldFail() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo(LENIENT_SAME); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo(LENIENT_SAME); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -490,62 +490,62 @@ public class JsonContentAssertTests { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToWhenStringIsNotMatchingShouldFail() throws Exception { |
|
|
|
public void isNotEqualToWhenStringIsNotMatchingShouldPass() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo(DIFFERENT); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo(DIFFERENT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToWhenResourcePathIsMatchingShouldPass() throws Exception { |
|
|
|
public void isNotEqualToWhenResourcePathIsMatchingShouldFail() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo("lenient-same.json"); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo("lenient-same.json"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToWhenResourcePathIsNotMatchingShouldFail() throws Exception { |
|
|
|
public void isNotEqualToWhenResourcePathIsNotMatchingShouldPass() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo("different.json"); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo("different.json"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToWhenBytesAreMatchingShouldPass() throws Exception { |
|
|
|
public void isNotEqualToWhenBytesAreMatchingShouldFail() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo(LENIENT_SAME.getBytes()); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo(LENIENT_SAME.getBytes()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToWhenBytesAreNotMatchingShouldFail() throws Exception { |
|
|
|
public void isNotEqualToWhenBytesAreNotMatchingShouldPass() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo(DIFFERENT.getBytes()); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo(DIFFERENT.getBytes()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToWhenFileIsMatchingShouldPass() throws Exception { |
|
|
|
public void isNotEqualToWhenFileIsMatchingShouldFail() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo(createFile(LENIENT_SAME)); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo(createFile(LENIENT_SAME)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToWhenFileIsNotMatchingShouldFail() throws Exception { |
|
|
|
public void isNotEqualToWhenFileIsNotMatchingShouldPass() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo(createFile(DIFFERENT)); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo(createFile(DIFFERENT)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToWhenInputStreamIsMatchingShouldPass() throws Exception { |
|
|
|
public void isNotEqualToWhenInputStreamIsMatchingShouldFail() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo(createInputStream(LENIENT_SAME)); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo(createInputStream(LENIENT_SAME)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToWhenInputStreamIsNotMatchingShouldFail() throws Exception { |
|
|
|
public void isNotEqualToWhenInputStreamIsNotMatchingShouldPass() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo(createInputStream(DIFFERENT)); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo(createInputStream(DIFFERENT)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToWhenResourceIsMatchingShouldPass() throws Exception { |
|
|
|
public void isNotEqualToWhenResourceIsMatchingShouldFail() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo(createResource(LENIENT_SAME)); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo(createResource(LENIENT_SAME)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToWhenResourceIsNotMatchingShouldFail() throws Exception { |
|
|
|
public void isNotEqualToWhenResourceIsNotMatchingShouldPass() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo(createResource(DIFFERENT)); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualTo(createResource(DIFFERENT)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenStringIsMatchingShouldPass() throws Exception { |
|
|
|
public void isNotEqualToJsonWhenStringIsMatchingShouldFail() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -555,359 +555,357 @@ public class JsonContentAssertTests { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenStringIsNotMatchingShouldFail() throws Exception { |
|
|
|
public void isNotEqualToJsonWhenStringIsNotMatchingShouldPass() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenResourcePathIsMatchingShouldPass() throws Exception { |
|
|
|
public void isNotEqualToJsonWhenResourcePathIsMatchingShouldFail() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("lenient-same.json"); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("lenient-same.json"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenResourcePathIsNotMatchingShouldFail() |
|
|
|
public void isNotEqualToJsonWhenResourcePathIsNotMatchingShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("different.json"); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("different.json"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenResourcePathAndClassIsMatchingShouldPass() |
|
|
|
public void isNotEqualToJsonWhenResourcePathAndClassAreMatchingShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("lenient-same.json", getClass()); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("lenient-same.json", getClass()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenResourcePathAndClassIsNotMatchingShouldFail() |
|
|
|
public void isNotEqualToJsonWhenResourcePathAndClassAreNotMatchingShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("different.json", getClass()); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("different.json", getClass()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenBytesAreMatchingShouldPass() throws Exception { |
|
|
|
public void isNotEqualToJsonWhenBytesAreMatchingShouldFail() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME.getBytes()); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME.getBytes()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenBytesAreNotMatchingShouldFail() throws Exception { |
|
|
|
public void isNotEqualToJsonWhenBytesAreNotMatchingShouldPass() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT.getBytes()); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT.getBytes()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenFileIsMatchingShouldPass() throws Exception { |
|
|
|
public void isNotEqualToJsonWhenFileIsMatchingShouldFail() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createFile(LENIENT_SAME)); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createFile(LENIENT_SAME)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenFileIsNotMatchingShouldFail() throws Exception { |
|
|
|
public void isNotEqualToJsonWhenFileIsNotMatchingShouldPass() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createFile(DIFFERENT)); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createFile(DIFFERENT)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenInputStreamIsMatchingShouldPass() throws Exception { |
|
|
|
public void isNotEqualToJsonWhenInputStreamIsMatchingShouldFail() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(LENIENT_SAME)); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(LENIENT_SAME)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenInputStreamIsNotMatchingShouldFail() |
|
|
|
public void isNotEqualToJsonWhenInputStreamIsNotMatchingShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(DIFFERENT)); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(DIFFERENT)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenResourceIsMatchingShouldPass() throws Exception { |
|
|
|
public void isNotEqualToJsonWhenResourceIsMatchingShouldFail() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(LENIENT_SAME)); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(LENIENT_SAME)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenResourceIsNotMatchingShouldFail() throws Exception { |
|
|
|
public void isNotEqualToJsonWhenResourceIsNotMatchingShouldPass() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(DIFFERENT)); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(DIFFERENT)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotStrictlyEqualToJsonWhenStringIsMatchingShouldPass() |
|
|
|
public void isNotStrictlyEqualToJsonWhenStringIsMatchingShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(SOURCE); |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(SOURCE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotStrictlyEqualToJsonWhenStringIsNotMatchingShouldFail() |
|
|
|
public void isNotStrictlyEqualToJsonWhenStringIsNotMatchingShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(LENIENT_SAME); |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(LENIENT_SAME); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotStrictlyEqualToJsonWhenResourcePathIsMatchingShouldPass() |
|
|
|
public void isNotStrictlyEqualToJsonWhenResourcePathIsMatchingShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson("source.json"); |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson("source.json"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotStrictlyEqualToJsonWhenResourcePathIsNotMatchingShouldFail() |
|
|
|
public void isNotStrictlyEqualToJsonWhenResourcePathIsNotMatchingShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson("lenient-same.json"); |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson("lenient-same.json"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotStrictlyEqualToJsonWhenResourcePathAndClassIsMatchingShouldPass() |
|
|
|
public void isNotStrictlyEqualToJsonWhenResourcePathAndClassAreMatchingShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson("source.json", getClass()); |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson("source.json", getClass()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotStrictlyEqualToJsonWhenResourcePathAndClassIsNotMatchingShouldFail() |
|
|
|
public void isNotStrictlyEqualToJsonWhenResourcePathAndClassAreNotMatchingShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson("lenient-same.json", |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson("lenient-same.json", |
|
|
|
getClass()); |
|
|
|
getClass()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotStrictlyEqualToJsonWhenBytesAreMatchingShouldPass() |
|
|
|
public void isNotStrictlyEqualToJsonWhenBytesAreMatchingShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(SOURCE.getBytes()); |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(SOURCE.getBytes()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotStrictlyEqualToJsonWhenBytesAreNotMatchingShouldFail() |
|
|
|
public void isNotStrictlyEqualToJsonWhenBytesAreNotMatchingShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(LENIENT_SAME.getBytes()); |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(LENIENT_SAME.getBytes()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotStrictlyEqualToJsonWhenFileIsMatchingShouldPass() throws Exception { |
|
|
|
public void isNotStrictlyEqualToJsonWhenFileIsMatchingShouldFail() throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(createFile(SOURCE)); |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(createFile(SOURCE)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotStrictlyEqualToJsonWhenFileIsNotMatchingShouldFail() |
|
|
|
public void isNotStrictlyEqualToJsonWhenFileIsNotMatchingShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(createFile(LENIENT_SAME)); |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(createFile(LENIENT_SAME)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotStrictlyEqualToJsonWhenInputStreamIsMatchingShouldPass() |
|
|
|
public void isNotStrictlyEqualToJsonWhenInputStreamIsMatchingShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(createInputStream(SOURCE)); |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(createInputStream(SOURCE)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotStrictlyEqualToJsonWhenInputStreamIsNotMatchingShouldFail() |
|
|
|
public void isNotStrictlyEqualToJsonWhenInputStreamIsNotMatchingShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)) |
|
|
|
assertThat(forJson(SOURCE)) |
|
|
|
.isNotStrictlyEqualToJson(createInputStream(LENIENT_SAME)); |
|
|
|
.isNotStrictlyEqualToJson(createInputStream(LENIENT_SAME)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotStrictlyEqualToJsonWhenResourceIsMatchingShouldPass() |
|
|
|
public void isNotStrictlyEqualToJsonWhenResourceIsMatchingShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(createResource(SOURCE)); |
|
|
|
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(createResource(SOURCE)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotStrictlyEqualToJsonWhenResourceIsNotMatchingShouldFail() |
|
|
|
public void isNotStrictlyEqualToJsonWhenResourceIsNotMatchingShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)) |
|
|
|
assertThat(forJson(SOURCE)) |
|
|
|
.isNotStrictlyEqualToJson(createResource(LENIENT_SAME)); |
|
|
|
.isNotStrictlyEqualToJson(createResource(LENIENT_SAME)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenStringIsMatchingAndLenientShouldPass() |
|
|
|
public void isNotEqualToJsonWhenStringIsMatchingAndLenientShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME, |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME, |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenStringIsNotMatchingAndLenientShouldFail() |
|
|
|
public void isNotEqualToJsonWhenStringIsNotMatchingAndLenientShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT, JSONCompareMode.LENIENT); |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT, JSONCompareMode.LENIENT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenResourcePathIsMatchingAndLenientShouldPass() |
|
|
|
public void isNotEqualToJsonWhenResourcePathIsMatchingAndLenientShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("lenient-same.json", |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("lenient-same.json", |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenResourcePathIsNotMatchingAndLenientShouldFail() |
|
|
|
public void isNotEqualToJsonWhenResourcePathIsNotMatchingAndLenientShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("different.json", |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("different.json", |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenResourcePathAndClassIsMatchingAndLenientShouldPass() |
|
|
|
public void isNotEqualToJsonWhenResourcePathAndClassAreMatchingAndLenientShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("lenient-same.json", getClass(), |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("lenient-same.json", getClass(), |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenResourcePathAndClassIsNotMatchingAndLenientShouldFail() |
|
|
|
public void isNotEqualToJsonWhenResourcePathAndClassAreNotMatchingAndLenientShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("different.json", getClass(), |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("different.json", getClass(), |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenBytesAreMatchingAndLenientShouldPass() |
|
|
|
public void isNotEqualToJsonWhenBytesAreMatchingAndLenientShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME.getBytes(), |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME.getBytes(), |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenBytesAreNotMatchingAndLenientShouldFail() |
|
|
|
public void isNotEqualToJsonWhenBytesAreNotMatchingAndLenientShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT.getBytes(), |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT.getBytes(), |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenFileIsMatchingAndLenientShouldPass() |
|
|
|
public void isNotEqualToJsonWhenFileIsMatchingAndLenientShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createFile(LENIENT_SAME), |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createFile(LENIENT_SAME), |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenFileIsNotMatchingAndLenientShouldFail() |
|
|
|
public void isNotEqualToJsonWhenFileIsNotMatchingAndLenientShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createFile(DIFFERENT), |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createFile(DIFFERENT), |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenInputStreamIsMatchingAndLenientShouldPass() |
|
|
|
public void isNotEqualToJsonWhenInputStreamIsMatchingAndLenientShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(LENIENT_SAME), |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(LENIENT_SAME), |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenInputStreamIsNotMatchingAndLenientShouldFail() |
|
|
|
public void isNotEqualToJsonWhenInputStreamIsNotMatchingAndLenientShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(DIFFERENT), |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(DIFFERENT), |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenResourceIsMatchingAndLenientShouldPass() |
|
|
|
public void isNotEqualToJsonWhenResourceIsMatchingAndLenientShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(LENIENT_SAME), |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(LENIENT_SAME), |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenResourceIsNotMatchingAndLenientShouldFail() |
|
|
|
public void isNotEqualToJsonWhenResourceIsNotMatchingAndLenientShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(DIFFERENT), |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(DIFFERENT), |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
JSONCompareMode.LENIENT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenStringIsMatchingAndComparatorShouldPass() |
|
|
|
public void isNotEqualToJsonWhenStringIsMatchingAndComparatorShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME, |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME, |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenStringIsNotMatchingAndComparatorShouldFail() |
|
|
|
public void isNotEqualToJsonWhenStringIsNotMatchingAndComparatorShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT, |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT, |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenResourcePathIsMatchingAndComparatorShouldPass() |
|
|
|
public void isNotEqualToJsonWhenResourcePathIsMatchingAndComparatorShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("lenient-same.json", |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("lenient-same.json", |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenResourcePathIsNotMatchingAndComparatorShouldFail() |
|
|
|
public void isNotEqualToJsonWhenResourcePathIsNotMatchingAndComparatorShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("different.json", |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("different.json", |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenResourcePathIsMatchingAndClassAndComparatorShouldPass() |
|
|
|
public void isNotEqualToJsonWhenResourcePathAndClassAreMatchingAndComparatorShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("lenient-same.json", getClass(), |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("lenient-same.json", getClass(), |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenResourcePathAndClassAndComparatorIsNotMatchingShouldFail() |
|
|
|
public void isNotEqualToJsonWhenResourcePathAndClassAreNotMatchingAndComparatorShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("different.json", getClass(), |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson("different.json", getClass(), |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenBytesAreMatchingAndComparatorShouldPass() |
|
|
|
public void isNotEqualToJsonWhenBytesAreMatchingAndComparatorShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME.getBytes(), |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME.getBytes(), |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenBytesAreNotMatchingAndComparatorShouldFail() |
|
|
|
public void isNotEqualToJsonWhenBytesAreNotMatchingAndComparatorShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT.getBytes(), |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT.getBytes(), |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenFileIsMatchingAndComparatorShouldPass() |
|
|
|
public void isNotEqualToJsonWhenFileIsMatchingAndComparatorShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createFile(LENIENT_SAME), |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createFile(LENIENT_SAME), |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenFileIsNotMatchingAndComparatorShouldFail() |
|
|
|
public void isNotEqualToJsonWhenFileIsNotMatchingAndComparatorShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createFile(DIFFERENT), |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createFile(DIFFERENT), |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenInputStreamIsMatchingAndComparatorShouldPass() |
|
|
|
public void isNotEqualToJsonWhenInputStreamIsMatchingAndComparatorShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(LENIENT_SAME), |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(LENIENT_SAME), |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenInputStreamIsNotMatchingAndComparatorShouldFail() |
|
|
|
public void isNotEqualToJsonWhenInputStreamIsNotMatchingAndComparatorShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(DIFFERENT), |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(DIFFERENT), |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
@Test(expected = AssertionError.class) |
|
|
|
public void isNotEqualToJsonWhenResourceIsMatchingAndComparatorShouldPass() |
|
|
|
public void isNotEqualToJsonWhenResourceIsMatchingAndComparatorShouldFail() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(LENIENT_SAME), |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(LENIENT_SAME), |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void isNotEqualToJsonWhenResourceIsNotMatchingAndComparatorShouldFail() |
|
|
|
public void isNotEqualToJsonWhenResourceIsNotMatchingAndComparatorShouldPass() |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(DIFFERENT), |
|
|
|
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(DIFFERENT), |
|
|
|
JsonContentAssertTests.COMPARATOR); |
|
|
|
COMPARATOR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void hasJsonPathValue() throws Exception { |
|
|
|
public void hasJsonPathValue() throws Exception { |
|
|
|
System.out.println(TYPES.replace("'", "\"")); |
|
|
|
|
|
|
|
System.out.println(SIMPSONS.replace("'", "\"")); |
|
|
|
|
|
|
|
assertThat(forJson(TYPES)).hasJsonPathValue("$.str"); |
|
|
|
assertThat(forJson(TYPES)).hasJsonPathValue("$.str"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1094,7 +1092,7 @@ public class JsonContentAssertTests { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void hasJsonPathStringValueForAnEmptyStringForNonString() throws Exception { |
|
|
|
public void hasJsonPathStringValueForNonString() throws Exception { |
|
|
|
String expression = "$.bool"; |
|
|
|
String expression = "$.bool"; |
|
|
|
this.thrown.expect(AssertionError.class); |
|
|
|
this.thrown.expect(AssertionError.class); |
|
|
|
this.thrown.expectMessage( |
|
|
|
this.thrown.expectMessage( |
|
|
|
@ -1150,17 +1148,17 @@ public class JsonContentAssertTests { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void assertValueIsMap() throws Exception { |
|
|
|
public void hasJsonPathMapValue() throws Exception { |
|
|
|
assertThat(forJson(TYPES)).hasJsonPathMapValue("$.colorMap"); |
|
|
|
assertThat(forJson(TYPES)).hasJsonPathMapValue("$.colorMap"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void assertValueIsMapForAnEmptyMap() throws Exception { |
|
|
|
public void hasJsonPathMapValueForAnEmptyMap() throws Exception { |
|
|
|
assertThat(forJson(TYPES)).hasJsonPathMapValue("$.emptyMap"); |
|
|
|
assertThat(forJson(TYPES)).hasJsonPathMapValue("$.emptyMap"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void assertValueIsMapForNonMap() throws Exception { |
|
|
|
public void hasJsonPathMapValueForNonMap() throws Exception { |
|
|
|
String expression = "$.str"; |
|
|
|
String expression = "$.str"; |
|
|
|
this.thrown.expect(AssertionError.class); |
|
|
|
this.thrown.expect(AssertionError.class); |
|
|
|
this.thrown.expectMessage( |
|
|
|
this.thrown.expectMessage( |
|
|
|
@ -1314,7 +1312,7 @@ public class JsonContentAssertTests { |
|
|
|
private static String loadJson(String path) { |
|
|
|
private static String loadJson(String path) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
ClassPathResource resource = new ClassPathResource(path, |
|
|
|
ClassPathResource resource = new ClassPathResource(path, |
|
|
|
JsonContentAssert.class); |
|
|
|
JsonContentAssertTests.class); |
|
|
|
return new String(FileCopyUtils.copyToByteArray(resource.getInputStream())); |
|
|
|
return new String(FileCopyUtils.copyToByteArray(resource.getInputStream())); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) { |
|
|
|
catch (Exception ex) { |
|
|
|
|