private void validateMapCodec(JsonCodec<Map<String, Person>> jsonCodec) { ImmutableMap<String, Person> expected = ImmutableMap.<String, Person>builder() .put("dain", new Person().setName("dain").setRocks(true)) .put("martin", new Person().setName("martin").setRocks(true)) .put("mark", new Person().setName("mark").setRocks(true)) .build(); String json = jsonCodec.toJson(expected); Map<String, Person> actual = jsonCodec.fromJson(json); Assert.assertEquals(actual, expected); }
@Test public void testJsonCodec() throws Exception { JsonCodec<Person> jsonCodec = jsonCodecFactory.jsonCodec(Person.class); Person expected = new Person().setName("dain").setRocks(true); String json = jsonCodec.toJson(expected); Person actual = jsonCodec.fromJson(json); Assert.assertEquals(actual, expected); }
private void validateListCodec(JsonCodec<List<Person>> jsonCodec) { ImmutableList<Person> expected = ImmutableList.of( new Person().setName("dain").setRocks(true), new Person().setName("martin").setRocks(true), new Person().setName("mark").setRocks(true)); String json = jsonCodec.toJson(expected); List<Person> actual = jsonCodec.fromJson(json); assertEquals(actual, expected); }
private void validateListCodec(JsonCodec<List<Person>> jsonCodec) { ImmutableList<Person> expected = ImmutableList.of( new Person().setName("dain").setRocks(true), new Person().setName("martin").setRocks(true), new Person().setName("mark").setRocks(true)); String json = jsonCodec.toJson(expected); List<Person> actual = jsonCodec.fromJson(json); assertEquals(actual, expected); }
private void validateListCodec(JsonCodec<List<Person>> jsonCodec) { ImmutableList<Person> expected = ImmutableList.of( new Person().setName("dain").setRocks(true), new Person().setName("martin").setRocks(true), new Person().setName("mark").setRocks(true)); String json = jsonCodec.toJson(expected); List<Person> actual = jsonCodec.fromJson(json); Assert.assertEquals(actual, expected); }
@Test public void testJsonCodec() throws Exception { JsonCodec<Person> jsonCodec = jsonCodecFactory.jsonCodec(Person.class); Person expected = new Person().setName("dain").setRocks(true); String json = jsonCodec.toJson(expected); Person actual = jsonCodec.fromJson(json); assertEquals(actual, expected); }
private void validateMapCodec(JsonCodec<Map<String, Person>> jsonCodec) { ImmutableMap<String, Person> expected = ImmutableMap.<String, Person>builder() .put("dain", new Person().setName("dain").setRocks(true)) .put("martin", new Person().setName("martin").setRocks(true)) .put("mark", new Person().setName("mark").setRocks(true)) .build(); String json = jsonCodec.toJson(expected); Map<String, Person> actual = jsonCodec.fromJson(json); assertEquals(actual, expected); }
@Test public void testJsonCodec() throws Exception { JsonCodec<Person> jsonCodec = jsonCodecFactory.jsonCodec(Person.class); Person expected = new Person().setName("dain").setRocks(true); String json = jsonCodec.toJson(expected); Person actual = jsonCodec.fromJson(json); assertEquals(actual, expected); }
private void validateMapCodec(JsonCodec<Map<String, Person>> jsonCodec) { ImmutableMap<String, Person> expected = ImmutableMap.<String, Person>builder() .put("dain", new Person().setName("dain").setRocks(true)) .put("martin", new Person().setName("martin").setRocks(true)) .put("mark", new Person().setName("mark").setRocks(true)) .build(); String json = jsonCodec.toJson(expected); Map<String, Person> actual = jsonCodec.fromJson(json); assertEquals(actual, expected); }