### Question:
JsonCodec implements ContentCodec { @Override public byte[] valueToBytes(Object value, Map<String, String> parameters) throws ContentCodecException { try { return getMapper().writeValueAsBytes(value); } catch (JsonProcessingException e) { throw new ContentCodecException("Failed to encode " + getMediaType() + ": " + e.toString()); } }  @Override String getMediaType(); @Override T bytesToValue(byte[] body,
                              DataSchema<T> schema,
                              Map<String, String> parameters); @Override byte[] valueToBytes(Object value,
                               Map<String, String> parameters);  }### Answer:
@Test public void valueToBytes() throws ContentCodecException { List<String> value = Arrays.asList("foo", "bar"); byte[] bytes = codec.valueToBytes(value); assertEquals("[\"foo\",\"bar\"]", new String(bytes)); }