@Test
    public void testFromMapFailure() {
        // min_version can't be < 0.
        Map<String, Short> invalidWithBadMinVersion =
            mkMap(mkEntry("min_version", (short) -1), mkEntry("max_version", (short) 0));
        assertThrows(
            IllegalArgumentException.class,
            () -> SupportedVersionRange.fromMap(invalidWithBadMinVersion));

        // max_version can't be < 0.
        Map<String, Short> invalidWithBadMaxVersion =
            mkMap(mkEntry("min_version", (short) 0), mkEntry("max_version", (short) -1));
        assertThrows(
            IllegalArgumentException.class,
            () -> SupportedVersionRange.fromMap(invalidWithBadMaxVersion));

        // min_version and max_version can't be < 0.
        Map<String, Short> invalidWithBadMinMaxVersion =
            mkMap(mkEntry("min_version", (short) -1), mkEntry("max_version", (short) -1));
        assertThrows(
            IllegalArgumentException.class,
            () -> SupportedVersionRange.fromMap(invalidWithBadMinMaxVersion));

        // min_version can't be > max_version.
        Map<String, Short> invalidWithLowerMaxVersion =
            mkMap(mkEntry("min_version", (short) 2), mkEntry("max_version", (short) 1));
        assertThrows(
            IllegalArgumentException.class,
            () -> SupportedVersionRange.fromMap(invalidWithLowerMaxVersion));

        // min_version key missing.
        Map<String, Short> invalidWithMinKeyMissing =
            mkMap(mkEntry("max_version", (short) 1));
        assertThrows(
            IllegalArgumentException.class,
            () -> SupportedVersionRange.fromMap(invalidWithMinKeyMissing));

        // max_version key missing.
        Map<String, Short> invalidWithMaxKeyMissing =
            mkMap(mkEntry("min_version", (short) 1));
        assertThrows(
            IllegalArgumentException.class,
            () -> SupportedVersionRange.fromMap(invalidWithMaxKeyMissing));
    }
Unit tests for the SupportedVersionRange class.
Along the way, this suite also includes extensive tests for the base class BaseVersionRange.
clients/src/test/java/org/apache/kafka/common/feature/SupportedVersionRangeTest.java