StringSerde implements Serde<String> { public StringSerde(String encoding) { this.encoding = encoding; } StringSerde(String encoding);  StringSerde(); byte[] toBytes(String obj); String fromBytes(byte[] bytes);  }
@Test public void testStringSerde() { StringSerde serde = new StringSerde("UTF-8"); assertNull(serde.toBytes(null)); assertNull(serde.fromBytes(null)); String fooBar = "foo bar"; byte[] fooBarBytes = serde.toBytes(fooBar); assertArrayEquals(fooBar.getBytes(StandardCharsets.UTF_8), fooBarBytes); assertEquals(fooBar, serde.fromBytes(fooBarBytes)); }