Minor format changes.
This commit is contained in:
parent
4c6e4c19a6
commit
db6811406c
@ -24,13 +24,28 @@ public class JsonbTest {
|
|||||||
public void givenPersonObject_whenSerializeWithJsonb_thenGetPersonJson() {
|
public void givenPersonObject_whenSerializeWithJsonb_thenGetPersonJson() {
|
||||||
Person person = new Person(1, "Jhon", "jhon@test.com", 20, LocalDate.of(2019, 9, 7), BigDecimal.valueOf(1000));
|
Person person = new Person(1, "Jhon", "jhon@test.com", 20, LocalDate.of(2019, 9, 7), BigDecimal.valueOf(1000));
|
||||||
String jsonPerson = jsonb.toJson(person);
|
String jsonPerson = jsonb.toJson(person);
|
||||||
assertTrue("{\"email\":\"jhon@test.com\",\"id\":1,\"person-name\":\"Jhon\",\"registeredDate\":\"07-09-2019\",\"salary\":\"1000.0\"}".equals(jsonPerson));
|
//// @formatter:off
|
||||||
|
String jsonExpected =
|
||||||
|
"{\"email\":\"jhon@test.com\"," +
|
||||||
|
"\"id\":1," +
|
||||||
|
"\"person-name\":\"Jhon\"," +
|
||||||
|
"\"registeredDate\":\"07-09-2019\"," +
|
||||||
|
"\"salary\":\"1000.0\"}";
|
||||||
|
// @formatter:on
|
||||||
|
assertTrue(jsonExpected.equals(jsonPerson));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenPersonJson_whenDeserializeWithJsonb_thenGetPersonObject() {
|
public void givenPersonJson_whenDeserializeWithJsonb_thenGetPersonObject() {
|
||||||
Person person = new Person(1, "Jhon", "jhon@test.com", 0, LocalDate.of(2019, 9, 7), BigDecimal.valueOf(1000.0));
|
Person person = new Person(1, "Jhon", "jhon@test.com", 0, LocalDate.of(2019, 9, 7), BigDecimal.valueOf(1000.0));
|
||||||
String jsonPerson = "{\"email\":\"jhon@test.com\",\"id\":1,\"person-name\":\"Jhon\",\"registeredDate\":\"07-09-2019\",\"salary\":\"1000.0\"}";
|
// @formatter:off
|
||||||
|
String jsonPerson =
|
||||||
|
"{\"email\":\"jhon@test.com\"," +
|
||||||
|
"\"id\":1," +
|
||||||
|
"\"person-name\":\"Jhon\"," +
|
||||||
|
"\"registeredDate\":\"07-09-2019\"," +
|
||||||
|
"\"salary\":\"1000.0\"}";
|
||||||
|
// @formatter:on
|
||||||
assertTrue(jsonb.fromJson(jsonPerson, Person.class)
|
assertTrue(jsonb.fromJson(jsonPerson, Person.class)
|
||||||
.equals(person));
|
.equals(person));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user