public static <T> T readVersionAndDeSerialize(
            SimpleVersionedSerializer<T> serializer, DataInputView in) throws IOException {
        checkNotNull(serializer, "serializer");
        checkNotNull(in, "in");

        final int version = in.readInt();
        final int length = in.readInt();
        final byte[] data = new byte[length];
        in.readFully(data);

        return serializer.deserialize(version, data);
    }
@Test
    void testUnderflow() throws Exception {
        assertThatExceptionOfType(IllegalArgumentException.class)
                .isThrownBy(
                        () ->
                                SimpleVersionedSerialization.readVersionAndDeSerialize(
                                        new TestStringSerializer(), new byte[7]));
    }