### Question:
ByteArrayConverter implements Converter { @Override public byte[] fromConnectData(String topic, Schema schema, Object value) { if (schema != null && schema.type() != Schema.Type.BYTES) throw new DataException("Invalid schema type for ByteArrayConverter: " + schema.type().toString()); if (value != null && !(value instanceof byte[])) throw new DataException("ByteArrayConverter is not compatible with objects of type " + value.getClass()); return (byte[]) value; }  @Override void configure(Map<String, ?> configs, boolean isKey); @Override byte[] fromConnectData(String topic, Schema schema, Object value); @Override SchemaAndValue toConnectData(String topic, byte[] value);  }### Answer:
@Test public void testFromConnect() { assertArrayEquals( SAMPLE_BYTES, converter.fromConnectData(TOPIC, Schema.BYTES_SCHEMA, SAMPLE_BYTES) ); }
@Test public void testFromConnectSchemaless() { assertArrayEquals( SAMPLE_BYTES, converter.fromConnectData(TOPIC, null, SAMPLE_BYTES) ); }
@Test(expected = DataException.class) public void testFromConnectBadSchema() { converter.fromConnectData(TOPIC, Schema.INT32_SCHEMA, SAMPLE_BYTES); }
@Test(expected = DataException.class) public void testFromConnectInvalidValue() { converter.fromConnectData(TOPIC, Schema.BYTES_SCHEMA, 12); }
@Test public void testFromConnectNull() { assertNull(converter.fromConnectData(TOPIC, Schema.BYTES_SCHEMA, null)); }