Ejemplo n.º 1
0
  @Test
  public void testDeserializesId() {
    IdTypeAdapter typeAdapter = new IdTypeAdapter();

    Id id = typeAdapter.deserialize(new JsonPrimitive("foo"), Id.class, null);

    assertThat(id).isEqualTo(new Id("foo"));
  }
Ejemplo n.º 2
0
  @Test
  public void testSerializesId() {
    IdTypeAdapter typeAdapter = new IdTypeAdapter();

    JsonElement element = typeAdapter.serialize(new Id("foo"), Id.class, null);

    assertThat(element).isInstanceOf(JsonPrimitive.class);
    assertThat(((JsonPrimitive) element).getAsString()).isEqualTo("foo");
  }