public static SupportedVersionRange fromMap(Map<String, Short> versionRangeMap) {
        return new SupportedVersionRange(
            BaseVersionRange.valueOrThrow(MIN_VERSION_KEY_LABEL, versionRangeMap),
            BaseVersionRange.valueOrThrow(MAX_VERSION_KEY_LABEL, versionRangeMap));
    }
@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));
    }