Skip to content

Commit 84adfdb

Browse files
committed
Update README.md
1 parent 0f598da commit 84adfdb

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

README.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@ JSONassert
33

44
Write JSON unit tests faster and with less code. Great for testing REST interfaces.
55

6+
It works like you expect. The strictness of the checking is tunable. Get understandable results back.
7+
68
Write and maintain this:
79

8-
`
910
JSONObject data = getRESTData("/friends/367.json");
10-
String expected ="{friends:[{id:123,name:\"Corby Page\"},"
11-
+ "{id:456,name:\"Carter Page\"}]}";
11+
String expected = "{friends:[{id:123,name:\"Corby Page\"},{id:456,name:\"Carter Page\"}]}";
1212
JSONAssert.assertEquals(expected, data, false);
13-
`
1413

15-
NOT this:
14+
NOT this (ouch!):
1615

17-
`
1816
JSONObject data = getRESTData("/friends/367.json");
1917
Assert.assertTrue(data.has("friends"));
2018
Object friendsObject = data.get("friends");
@@ -38,9 +36,5 @@ NOT this:
3836
Assert.assertEquals(123, friend2Obj.getInt("id"));
3937
}
4038
else {
41-
Assert.fail("Expected either Carter or Corby, Got: "
42-
+ friend1Obj.getString("name"));
39+
Assert.fail("Expected either Carter or Corby, Got: " + friend1Obj.getString("name"));
4340
}
44-
`
45-
46-
Right?

0 commit comments

Comments
 (0)