@Override
    public byte[] serialize(final String topic, final LeftOrRightValue<V1, V2> data) {
        if (data == null) {
            return null;
        }

        final byte[] rawValue = (data.getLeftValue() != null)
            ? leftSerializer.serialize(topic, data.getLeftValue())
            : rightSerializer.serialize(topic, data.getRightValue());

        if (rawValue == null) {
            return null;
        }

        return ByteBuffer
            .allocate(1 + rawValue.length)
            .put((byte) (data.getLeftValue() != null ? 1 : 0))
            .put(rawValue)
            .array();
    }
@Test
    public void shouldSerializeStringValue() {
        final String value = "some-string";

        final LeftOrRightValue<String, Integer> leftOrRightValue = LeftOrRightValue.makeLeftValue(value);

        final byte[] serialized =
            STRING_OR_INTEGER_SERDE.serializer().serialize(TOPIC, leftOrRightValue);

        assertThat(serialized, is(notNullValue()));

        final LeftOrRightValue<String, Integer> deserialized =
            STRING_OR_INTEGER_SERDE.deserializer().deserialize(TOPIC, serialized);

        assertThat(deserialized, is(leftOrRightValue));
    }