コード例 #1
0
  @Test
  public void should_deserialize_a_list_of_entities() throws Exception {
    Child jules = new Child("jules", 1);
    Child manon = new Child("manon", 0);
    String json = "[" + jules.toJson() + "," + manon.toJson() + "]";

    List<Child> deserialized = deserializer.deserializeList(json.getBytes(), Child.class);

    assertThat(deserialized).containsOnly(jules, manon);
  }
コード例 #2
0
  @Test
  public void should_deserialize_an_entity() throws Exception {
    Child jules = new Child("jules", 1);

    Child deserialized = deserializer.deserialize(jules.toJson().getBytes(), Child.class);

    assertThat(deserialized).isEqualTo(jules);
  }