use of co.cask.cdap.data.stream.decoder.StringStreamEventDecoder in project cdap by caskdata.
the class StreamInputFormatTest method testStringStreamEventDecoder.
@Test
public void testStringStreamEventDecoder() {
String body = "Testing";
StreamEvent event = new StreamEvent(ImmutableMap.<String, String>of(), Charsets.UTF_8.encode(body));
StreamEventDecoder<LongWritable, String> decoder = new StringStreamEventDecoder();
StreamEventDecoder.DecodeResult<LongWritable, String> result = new StreamEventDecoder.DecodeResult<>();
result = decoder.decode(event, result);
Assert.assertEquals(event.getTimestamp(), result.getKey().get());
Assert.assertEquals(body, result.getValue());
}
Aggregations