Skip to content

Commit 7414e90

Browse files
Updated ReadMe for syntax errors of strike of code (#147)
Syntax error corrections on strike of code. Correcting the assert methods name as Assert.assertTrue() Making assertion pass by swapping the value of friend1Obj with friend2Obj.
1 parent 5e73cb0 commit 7414e90

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

README.md

+12-11
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,23 @@ Assert.assertTrue(data.has("friends"));
2929
Object friendsObject = data.get("friends");
3030
Assert.assertTrue(friendsObject instanceof JSONArray);
3131
JSONArray friends = (JSONArray) friendsObject;
32-
Assert.assertEquals(2, data.length());
33-
JSONObject friend1Obj = friends.getJSONObject(data.get(0));
34-
Assert.true(friend1Obj.has("id"));
35-
Assert.true(friend1Obj.has("name"));
36-
JSONObject friend2Obj = friends.getJSONObject(data.get(1));
37-
Assert.true(friend2Obj.has("id"));
38-
Assert.true(friend2Obj.has("name"));
32+
Assert.assertEquals(2, friends.length());
33+
JSONObject friend1Obj = friends.getJSONObject(0);
34+
Assert.assertTrue(friend1Obj.has("id"));
35+
Assert.assertTrue(friend1Obj.has("name"));
36+
JSONObject friend2Obj = friends.getJSONObject(1);
37+
Assert.assertTrue(friend2Obj.has("id"));
38+
Assert.assertTrue(friend2Obj.has("name"));
39+
3940
if ("Carter Page".equals(friend1Obj.getString("name"))) {
40-
Assert.assertEquals(123, friend1Obj.getInt("id"));
41+
Assert.assertEquals(456, friend1Obj.getInt("id"));
4142
Assert.assertEquals("Corby Page", friend2Obj.getString("name"));
42-
Assert.assertEquals(456, friend2Obj.getInt("id"));
43+
Assert.assertEquals(123, friend2Obj.getInt("id"));
4344
}
4445
else if ("Corby Page".equals(friend1Obj.getString("name"))) {
45-
Assert.assertEquals(456, friend1Obj.getInt("id"));
46+
Assert.assertEquals(123, friend1Obj.getInt("id"));
4647
Assert.assertEquals("Carter Page", friend2Obj.getString("name"));
47-
Assert.assertEquals(123, friend2Obj.getInt("id"));
48+
Assert.assertEquals(456, friend2Obj.getInt("id"));
4849
}
4950
else {
5051
Assert.fail("Expected either Carter or Corby, Got: " + friend1Obj.getString("name"));

0 commit comments

Comments
 (0)