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(expected = IllegalArgumentException.class)
    public void testCreateSerializerAdapter_invalidSerializer() {
        SerializationUtil.createSerializerAdapter(new InvalidSerializer());
    }