use of co.cask.cdap.api.dataset.lib.partitioned.PartitionKeyCodec in project cdap by caskdata.
the class PartitionKeyCodecTest method testSerDe.
@Test
public void testSerDe() {
PartitionKey key = PartitionKey.builder().addField("a", "value,").addField("b", 1L).addField("c", -17).addField("d", true).addIntField("e", 42).addLongField("f", 15).addStringField("g", "value]}").build();
Gson gson = new GsonBuilder().registerTypeAdapter(PartitionKey.class, new PartitionKeyCodec()).create();
String serialized = gson.toJson(key);
Assert.assertEquals(key, gson.fromJson(serialized, PartitionKey.class));
}
Aggregations