Skip to content

Commit 3b854c0

Browse files
committed
Add testcase for field, expected and actual properties
1 parent 417cef9 commit 3b854c0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/test/java/org/skyscreamer/jsonassert/JSONAssertTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ public void testArrayOfArraysStrict() throws JSONException {
135135
public void testArrayOfArrays() throws JSONException {
136136
testPass("{id:1,stuff:[[4,3],[3,2],[],[1,2]]}", "{id:1,stuff:[[1,2],[2,3],[],[3,4]]}", false);
137137
}
138+
139+
@Test
140+
public void testFieldMismatch() throws JSONException {
141+
JSONCompareResult result = JSONCompare.compareJSON("{name:\"Pat\"}", "{name:\"Sue\"}", STRICT);
142+
Assert.assertEquals("Pat", result.getExpected());
143+
Assert.assertEquals("Sue", result.getActual());
144+
Assert.assertEquals("name", result.getField());
145+
}
138146

139147
private void testPass(String expected, String actual, boolean strict)
140148
throws JSONException

0 commit comments

Comments
 (0)