@Test public void parseVersion_emptyString() { final VersionNumber v = VersionParser.parseVersion(""); assertThat(v).isEqualTo(VersionNumber.UNKNOWN); }
public static VersionNumber parseVersion(@Nonnull final String version) { Check.notNull(version, "version"); VersionNumber result = new VersionNumber(new ArrayList<String>(0), version); final Matcher matcher = VERSIONSTRING.matcher(version); if (matcher.find()) { final List<String> groups = Arrays.asList(matcher.group(MAJOR_INDEX).split("\\.")); final String extension = matcher.group(EXTENSION_INDEX) == null ? VersionNumber.EMPTY_EXTENSION : trimRight(matcher .group(EXTENSION_INDEX)); result = new VersionNumber(groups, extension); } return result; }
VersionParser { public static VersionNumber parseVersion(@Nonnull final String version) { Check.notNull(version, "version"); VersionNumber result = new VersionNumber(new ArrayList<String>(0), version); final Matcher matcher = VERSIONSTRING.matcher(version); if (matcher.find()) { final List<String> groups = Arrays.asList(matcher.group(MAJOR_INDEX).split("\\.")); final String extension = matcher.group(EXTENSION_INDEX) == null ? VersionNumber.EMPTY_EXTENSION : trimRight(matcher .group(EXTENSION_INDEX)); result = new VersionNumber(groups, extension); } return result; } }
VersionParser { public static VersionNumber parseVersion(@Nonnull final String version) { Check.notNull(version, "version"); VersionNumber result = new VersionNumber(new ArrayList<String>(0), version); final Matcher matcher = VERSIONSTRING.matcher(version); if (matcher.find()) { final List<String> groups = Arrays.asList(matcher.group(MAJOR_INDEX).split("\\.")); final String extension = matcher.group(EXTENSION_INDEX) == null ? VersionNumber.EMPTY_EXTENSION : trimRight(matcher .group(EXTENSION_INDEX)); result = new VersionNumber(groups, extension); } return result; } private  VersionParser(); }
VersionParser { public static VersionNumber parseVersion(@Nonnull final String version) { Check.notNull(version, "version"); VersionNumber result = new VersionNumber(new ArrayList<String>(0), version); final Matcher matcher = VERSIONSTRING.matcher(version); if (matcher.find()) { final List<String> groups = Arrays.asList(matcher.group(MAJOR_INDEX).split("\\.")); final String extension = matcher.group(EXTENSION_INDEX) == null ? VersionNumber.EMPTY_EXTENSION : trimRight(matcher .group(EXTENSION_INDEX)); result = new VersionNumber(groups, extension); } return result; } private  VersionParser(); static VersionNumber parseLastVersionNumber(@Nonnull final String text); static VersionNumber parseOperatingSystemVersion(@Nonnull final OperatingSystemFamily family, @Nonnull final String userAgent); static VersionNumber parseVersion(@Nonnull final String version); }
VersionParser { public static VersionNumber parseVersion(@Nonnull final String version) { Check.notNull(version, "version"); VersionNumber result = new VersionNumber(new ArrayList<String>(0), version); final Matcher matcher = VERSIONSTRING.matcher(version); if (matcher.find()) { final List<String> groups = Arrays.asList(matcher.group(MAJOR_INDEX).split("\\.")); final String extension = matcher.group(EXTENSION_INDEX) == null ? VersionNumber.EMPTY_EXTENSION : trimRight(matcher .group(EXTENSION_INDEX)); result = new VersionNumber(groups, extension); } return result; } private  VersionParser(); static VersionNumber parseLastVersionNumber(@Nonnull final String text); static VersionNumber parseOperatingSystemVersion(@Nonnull final OperatingSystemFamily family, @Nonnull final String userAgent); static VersionNumber parseVersion(@Nonnull final String version);  }