@Test public void validJava7Version_WithUpdateNumber() { JavaVersion version = JavaVersionParser.parseJavaVersion("1.7.0_1234"); assertJavaVersionsEqual(jv(1, 7, 0, 1234), version); assertEquals(KnownJavaVersions.JAVA_7, version.getKnownVersion()); }
public static JavaVersion parseJavaVersion(final String fullVersionString) { if (!StringUtils.isNullOrEmpty(fullVersionString)) { final Matcher matcher = VERSION_REGEX.matcher(fullVersionString); if (matcher.matches()) { final Integer majorVersionFamily = NumberUtils.tryParseInt(matcher.group(1)); final Integer majorVersion = NumberUtils.tryParseInt(matcher.group(2)); final Integer maintenanceNumber = NumberUtils.tryParseInt(matcher.group(3)); final Integer updateNumber = NumberUtils.tryParseInt(matcher.group(4)); return new JavaVersion(majorVersionFamily, majorVersion, maintenanceNumber, updateNumber); } } return JavaVersion.UNKNOWN; }
JavaVersionParser { public static JavaVersion parseJavaVersion(final String fullVersionString) { if (!StringUtils.isNullOrEmpty(fullVersionString)) { final Matcher matcher = VERSION_REGEX.matcher(fullVersionString); if (matcher.matches()) { final Integer majorVersionFamily = NumberUtils.tryParseInt(matcher.group(1)); final Integer majorVersion = NumberUtils.tryParseInt(matcher.group(2)); final Integer maintenanceNumber = NumberUtils.tryParseInt(matcher.group(3)); final Integer updateNumber = NumberUtils.tryParseInt(matcher.group(4)); return new JavaVersion(majorVersionFamily, majorVersion, maintenanceNumber, updateNumber); } } return JavaVersion.UNKNOWN; } }
JavaVersionParser { public static JavaVersion parseJavaVersion(final String fullVersionString) { if (!StringUtils.isNullOrEmpty(fullVersionString)) { final Matcher matcher = VERSION_REGEX.matcher(fullVersionString); if (matcher.matches()) { final Integer majorVersionFamily = NumberUtils.tryParseInt(matcher.group(1)); final Integer majorVersion = NumberUtils.tryParseInt(matcher.group(2)); final Integer maintenanceNumber = NumberUtils.tryParseInt(matcher.group(3)); final Integer updateNumber = NumberUtils.tryParseInt(matcher.group(4)); return new JavaVersion(majorVersionFamily, majorVersion, maintenanceNumber, updateNumber); } } return JavaVersion.UNKNOWN; } private  JavaVersionParser(); }
JavaVersionParser { public static JavaVersion parseJavaVersion(final String fullVersionString) { if (!StringUtils.isNullOrEmpty(fullVersionString)) { final Matcher matcher = VERSION_REGEX.matcher(fullVersionString); if (matcher.matches()) { final Integer majorVersionFamily = NumberUtils.tryParseInt(matcher.group(1)); final Integer majorVersion = NumberUtils.tryParseInt(matcher.group(2)); final Integer maintenanceNumber = NumberUtils.tryParseInt(matcher.group(3)); final Integer updateNumber = NumberUtils.tryParseInt(matcher.group(4)); return new JavaVersion(majorVersionFamily, majorVersion, maintenanceNumber, updateNumber); } } return JavaVersion.UNKNOWN; } private  JavaVersionParser(); static JavaVersion getCurrentJavaVersion(); static JavaVersion parseJavaVersion(final String fullVersionString); }
JavaVersionParser { public static JavaVersion parseJavaVersion(final String fullVersionString) { if (!StringUtils.isNullOrEmpty(fullVersionString)) { final Matcher matcher = VERSION_REGEX.matcher(fullVersionString); if (matcher.matches()) { final Integer majorVersionFamily = NumberUtils.tryParseInt(matcher.group(1)); final Integer majorVersion = NumberUtils.tryParseInt(matcher.group(2)); final Integer maintenanceNumber = NumberUtils.tryParseInt(matcher.group(3)); final Integer updateNumber = NumberUtils.tryParseInt(matcher.group(4)); return new JavaVersion(majorVersionFamily, majorVersion, maintenanceNumber, updateNumber); } } return JavaVersion.UNKNOWN; } private  JavaVersionParser(); static JavaVersion getCurrentJavaVersion(); static JavaVersion parseJavaVersion(final String fullVersionString); static final String JAVA_VERSION_PROPERTY; }