### Question:
JsonTranscoder implements Transcoder { @Override public EncodedValue encode(final Object input) { if (input instanceof CommonOptions.BuiltCommonOptions || input instanceof CommonOptions) { throw InvalidArgumentException.fromMessage("No content provided, cannot " + "encode " + input.getClass().getSimpleName() + " as content!"); } if (input instanceof byte[]) { throw InvalidArgumentException.fromMessage("byte[] input is not supported for the JsonTranscoder!. " + "If you want to store already encoded JSON, use the RawJsonTranscoder, otherwise store it " + "with the RawBinaryTranscoder!"); } return new EncodedValue(serializer.serialize(input), CodecFlags.JSON_COMPAT_FLAGS); } private  JsonTranscoder(final JsonSerializer serializer); static JsonTranscoder create(JsonSerializer serializer); @Override EncodedValue encode(final Object input); @Override T decode(final Class<T> target, final byte[] input, int flags); @Override T decode(TypeRef<T> target, byte[] input, int flags);  }### Answer:
@Test void rejectsByteArrayEncode() { assertThrows(InvalidArgumentException.class, () -> JSON_TRANSCODER.encode(new byte[] {})); }
@Test void encodesJsonArray() { JsonArray input = JsonArray.from("1", true, 2); Transcoder.EncodedValue output = JSON_TRANSCODER.encode(input); assertEquals("[\"1\",true,2]", new String(output.encoded(), StandardCharsets.UTF_8)); }
@Test void encodesMap() { Map<String, Object> input = Collections.singletonMap("foo", "bar"); Transcoder.EncodedValue output = JSON_TRANSCODER.encode(input); assertEquals("{\"foo\":\"bar\"}", new String(output.encoded(), StandardCharsets.UTF_8)); }
@Test void encodesList() { List<Object> input = Arrays.asList("1", true, 2); Transcoder.EncodedValue output = JSON_TRANSCODER.encode(input); assertEquals("[\"1\",true,2]", new String(output.encoded(), StandardCharsets.UTF_8)); }
@Test void encodesSet() { Set<Object> input = new LinkedHashSet<>(); input.add("foo"); input.add("bar"); Transcoder.EncodedValue output = JSON_TRANSCODER.encode(input); assertEquals("[\"foo\",\"bar\"]", new String(output.encoded(), StandardCharsets.UTF_8)); }