Skip to content

Commit db68114

Browse files
author
juan
committed
Minor format changes.
1 parent 4c6e4c1 commit db68114

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

‎spring-5/src/test/java/com/baeldung/jsonb/JsonbTest.java‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,28 @@ public void setup() {
2424
public void givenPersonObject_whenSerializeWithJsonb_thenGetPersonJson() {
2525
Person person = new Person(1, "Jhon", "jhon@test.com", 20, LocalDate.of(2019, 9, 7), BigDecimal.valueOf(1000));
2626
String jsonPerson = jsonb.toJson(person);
27-
assertTrue("{\"email\":\"jhon@test.com\",\"id\":1,\"person-name\":\"Jhon\",\"registeredDate\":\"07-09-2019\",\"salary\":\"1000.0\"}".equals(jsonPerson));
27+
//// @formatter:off
28+
String jsonExpected =
29+
"{\"email\":\"jhon@test.com\"," +
30+
"\"id\":1," +
31+
"\"person-name\":\"Jhon\"," +
32+
"\"registeredDate\":\"07-09-2019\"," +
33+
"\"salary\":\"1000.0\"}";
34+
// @formatter:on
35+
assertTrue(jsonExpected.equals(jsonPerson));
2836
}
2937

3038
@Test
3139
public void givenPersonJson_whenDeserializeWithJsonb_thenGetPersonObject() {
3240
Person person = new Person(1, "Jhon", "jhon@test.com", 0, LocalDate.of(2019, 9, 7), BigDecimal.valueOf(1000.0));
33-
String jsonPerson = "{\"email\":\"jhon@test.com\",\"id\":1,\"person-name\":\"Jhon\",\"registeredDate\":\"07-09-2019\",\"salary\":\"1000.0\"}";
41+
// @formatter:off
42+
String jsonPerson =
43+
"{\"email\":\"jhon@test.com\"," +
44+
"\"id\":1," +
45+
"\"person-name\":\"Jhon\"," +
46+
"\"registeredDate\":\"07-09-2019\"," +
47+
"\"salary\":\"1000.0\"}";
48+
// @formatter:on
3449
assertTrue(jsonb.fromJson(jsonPerson, Person.class)
3550
.equals(person));
3651
}

0 commit comments

Comments
 (0)