public static Versions parse(String input, Versions defaultVersions) {
        if (input == null) {
            return defaultVersions;
        }
        String trimmedInput = input.trim();
        if (trimmedInput.isEmpty()) {
            return defaultVersions;
        }
        if (trimmedInput.equals(NONE_STRING)) {
            return NONE;
        }
        if (trimmedInput.endsWith("+")) {
            return new Versions(Short.parseShort(
            trimmedInput.substring(0, trimmedInput.length() - 1)),
                Short.MAX_VALUE);
        } else {
            int dashIndex = trimmedInput.indexOf("-");
            if (dashIndex < 0) {
                short version = Short.parseShort(trimmedInput);
                return new Versions(version, version);
            }
            return new Versions(
                Short.parseShort(trimmedInput.substring(0, dashIndex)),
                Short.parseShort(trimmedInput.substring(dashIndex + 1)));
        }
    }
@Test
    public void testVersionsParse() {
        assertEquals(Versions.NONE, Versions.parse(null, Versions.NONE));
        assertEquals(Versions.ALL, Versions.parse(" ", Versions.ALL));
        assertEquals(Versions.ALL, Versions.parse("", Versions.ALL));
        assertEquals(newVersions(4, 5), Versions.parse(" 4-5 ", null));
    }