Minor fixes

This commit is contained in:
gpq5 2019-06-23 12:35:44 +05:30
parent 0eeb8a37f5
commit 706035468b
1 changed files with 7 additions and 8 deletions

View File

@ -18,8 +18,8 @@ public class JsonCompareUnitTest {
public void givenTwoSameJsonDataObjects_whenCompared_thenAreEqual() throws IOException {
ObjectMapper mapper = new ObjectMapper();
String s1 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34 }}";
String s2 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34 }}";
String s1 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\", \"age\": 34 }}";
String s2 = "{\"employee\": {\"id\": \"1212\",\"age\": 34, \"fullName\": \"John Miles\" }}";
JsonNode actualObj1 = mapper.readTree(s1);
JsonNode actualObj2 = mapper.readTree(s2);
@ -29,11 +29,11 @@ public class JsonCompareUnitTest {
}
@Test
public void givenTwoSameNestedJsonDataObjects_whenCompared_thenAreEqual() throws IOException {
public void givenTwoSameNestedJsonDataObjects_whenCompared_thenEqual() throws IOException {
ObjectMapper mapper = new ObjectMapper();
String s1 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34,\n" + "\"contact\":{\"email\": \"john@xyz.com\",\"phone\": \"9999999999\"} }}";
String s2 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34,\n" + "\"contact\":{\"email\": \"john@xyz.com\",\"phone\": \"9999999999\"} }}";
String s1 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34, \"contact\":{\"email\": \"john@xyz.com\",\"phone\": \"9999999999\"} }}";
String s2 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34, \"contact\":{\"email\": \"john@xyz.com\",\"phone\": \"9999999999\"} }}";
JsonNode actualObj1 = mapper.readTree(s1);
JsonNode actualObj2 = mapper.readTree(s2);
@ -43,7 +43,7 @@ public class JsonCompareUnitTest {
}
@Test
public void givenTwoSameListJsonDataObjects_whenCompared_thenAreEqual() throws IOException {
public void givenTwoSameListJsonDataObjects_whenCompared_thenEqual() throws IOException {
ObjectMapper mapper = new ObjectMapper();
String s1 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34, \"skills\":[\"Java\", \"C++\", \"Python\"] }}";
@ -57,7 +57,7 @@ public class JsonCompareUnitTest {
}
@Test
public void givenTwoJsonDataObjects_whenComparedUsingCustomComparator_thenEqual() throws Exception {
public void givenTwoJsonDataObjects_whenComparedUsingCustomComparator_thenEqual() throws IOException {
ObjectMapper mapper = new ObjectMapper();
String s1 = "{\"name\": \"John\",\"score\":5.0}";
@ -65,7 +65,6 @@ public class JsonCompareUnitTest {
JsonNode actualObj1 = mapper.readTree(s1);
JsonNode actualObj2 = mapper.readTree(s2);
Comparator<JsonNode> cmp = new Comparator<JsonNode>() {
@Override
public int compare(JsonNode o1, JsonNode o2) {