@Test
    public void testParsingUnsupportedApiKey() {
        MetadataRecordSerde serde = new MetadataRecordSerde();
        ByteBuffer buffer = ByteBuffer.allocate(64);
        buffer.put((byte) 0x01); // frame version
        buffer.put((byte) 0xff); // apiKey
        buffer.put((byte) 0x7f); // apiKey
        buffer.put((byte) 0x00); // api version
        buffer.put((byte) 0x80);
        buffer.position(0);
        buffer.limit(64);
        assertStartsWith("Unknown metadata id ",
                assertThrows(MetadataParseException.class,
                        () -> serde.read(new ByteBufferAccessor(buffer), buffer.remaining())).getCause().getMessage());
    }
Test attempting to parse an event which has a unsupported version
metadata/src/test/java/org/apache/kafka/metadata/MetadataRecordSerdeTest.java