Skip to content

Commit ced3306

Browse files
Revert "Add Adapter Sample"
This reverts commit d20693e.
1 parent 19a9077 commit ced3306

3 files changed

Lines changed: 1 addition & 57 deletions

File tree

‎jsonb/src/main/java/com/baeldung/adapter/PersonAdapter.java‎

Lines changed: 0 additions & 26 deletions
This file was deleted.

‎jsonb/src/main/java/com/baeldung/jsonb/Person.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ public class Person {
2222
private BigDecimal salary;
2323

2424
public Person() {
25-
this(0, "", "", 0, LocalDate.now(), new BigDecimal(0));
2625
}
2726

2827
public Person(int id, String name, String email, int age, LocalDate registeredDate, BigDecimal salary) {
28+
super();
2929
this.id = id;
3030
this.name = name;
3131
this.email = email;

‎jsonb/src/test/java/com/baeldung/jsonb/JsonbTest.java‎

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
import org.apache.commons.collections4.ListUtils;
1818
import org.junit.Test;
1919

20-
import com.baeldung.adapter.PersonAdapter;
21-
2220
public class JsonbTest {
2321

2422
@Test
@@ -157,32 +155,4 @@ public void givenPersonJson_whenDeserializeWithJsonb_thenGetPersonObject() {
157155
.equals(person));
158156
}
159157

160-
@Test
161-
public void givenPersonObject_whenSerializeWithAdapter_thenGetPersonJson() {
162-
JsonbConfig config = new JsonbConfig().withAdapters(new PersonAdapter());
163-
Jsonb jsonb = JsonbBuilder.create(config);
164-
Person person = new Person(1, "Jhon", "jhon@test.com", 0, LocalDate.of(2019, 9, 7), BigDecimal.valueOf(1000.0));// new Person(1, "Jhon");
165-
String jsonPerson = jsonb.toJson(person);
166-
// @formatter:off
167-
String jsonExpected =
168-
"{\"id\":1," +
169-
"\"name\":\"Jhon\"}";
170-
// @formatter:on
171-
assertTrue(jsonExpected.equals(jsonPerson));
172-
}
173-
174-
@Test
175-
public void givenPersonJson_whenDeserializeWithAdapter_thenGetPersonObject() {
176-
JsonbConfig config = new JsonbConfig().withAdapters(new PersonAdapter());
177-
Jsonb jsonb = JsonbBuilder.create(config);
178-
Person person = new Person(1, "Jhon", "jhon@test.com", 0, LocalDate.of(2019, 9, 7), BigDecimal.valueOf(1000.0));// new Person(1, "Jhon");
179-
// @formatter:off
180-
String jsonPerson =
181-
"{\"id\":1," +
182-
"\"name\":\"Jhon\"}";
183-
// @formatter:on
184-
assertTrue(jsonb.fromJson(jsonPerson, Person.class)
185-
.equals(person));
186-
}
187-
188158
}

0 commit comments

Comments
 (0)