use of io.mantisrx.connector.kafka.source.serde.OffsetAndMetadataDeserializer in project mantis by Netflix.
the class FileBasedOffsetCheckpointStrategyTest method testOffsetAndMetadataSerialization.
@Test
public void testOffsetAndMetadataSerialization() {
OffsetAndMetadata expected = new OffsetAndMetadata(100, "tempmeta");
final SimpleModule module = new SimpleModule().addSerializer(OffsetAndMetadata.class, new OffsetAndMetadataSerializer()).addDeserializer(OffsetAndMetadata.class, new OffsetAndMetadataDeserializer());
final ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.registerModule(module);
try {
final String s = mapper.writeValueAsString(expected);
final OffsetAndMetadata actual = mapper.readValue(s, OffsetAndMetadata.class);
assertEquals(expected, actual);
} catch (IOException e) {
e.printStackTrace();
}
}
Aggregations