public static SerializerAdapter createSerializerAdapter(Serializer serializer) {
        final SerializerAdapter s;
        if (serializer instanceof StreamSerializer streamSerializer) {
            s = new StreamSerializerAdapter(streamSerializer);
        } else if (serializer instanceof ByteArraySerializer arraySerializer) {
            s = new ByteArraySerializerAdapter(arraySerializer);
        } else {
            throw new IllegalArgumentException("Serializer " + serializer.getClass().getName()
                    + " must be an instance of either StreamSerializer or ByteArraySerializer");
        }
        return s;
    }
@Test
    public void testCreateSerializerAdapter() {
        // ArrayStreamSerializer is instance of StreamSerializer, hence using it as parameter
        SerializerAdapter streamSerializerAdapter = SerializationUtil.createSerializerAdapter(new ArrayStreamSerializer());
        assertEquals(streamSerializerAdapter.getClass(), StreamSerializerAdapter.class);
        // CustomByteArraySerializer is instance of ByteArraySerializer, hence using it as parameter
        SerializerAdapter byteArraySerializerAdapter = SerializationUtil.createSerializerAdapter(new CustomByteArraySerializer());
        assertEquals(byteArraySerializerAdapter.getClass(), ByteArraySerializerAdapter.class);
    }