### Question:
Version implements Comparable<Version> { public static Version parse(@Nonnull final String version) { final Matcher matcher = Version.PATTERN.matcher(version); if (!matcher.matches()) { throw new IllegalArgumentException("<"+version+"> does not match format "+Version.FORMAT); } final int major = Integer.valueOf(matcher.group(1)); final int minor = Integer.valueOf(matcher.group(2)); final int patch; final String patchMatch = matcher.group(3); if (StringUtils.isNotEmpty(patchMatch)) { patch = Integer.valueOf(patchMatch); } else { patch = 0; } final String separator = matcher.group(4); final String special = matcher.group(5); return new Version(major, minor, patch, separator, "".equals(special) ? null : special); } Version(@Nonnegative final int major, @Nonnegative final int minor, @Nonnegative final int patch);  Version(@Nonnegative final int major, @Nonnegative final int minor, @Nonnegative final int patch, @Nullable final String separator, @Nullable final String special); static Version parse(@Nonnull final String version); Version next(@Nonnull final Version.Element element); Version toReleaseVersion(); boolean isInDevelopment(); boolean isStable(); boolean isSnapshot(); boolean isCompatible(Version version); @Override int hashCode(); @Override boolean equals(@Nullable final Object object); @Override int compareTo(final Version other); @Override String toString();  }### Answer:
@Test public void shouldValidVersionBeParsed() { Version.parse("1.2"); Version.parse("1.2.3"); Version.parse("10.20.30"); Version.parse("1.2.3beta"); Version.parse("1.2.3.DEV"); Version.parse("1.2.3.DEV-SNAPSHOT"); Version.parse("1.2-SNAPSHOT"); Version.parse("1.2.3-SNAPSHOT"); Version.parse("1.2.3-RC-SNAPSHOT"); Version.parse("1.2-RC-SNAPSHOT"); }
@Test(expected=IllegalArgumentException.class) public void shouldInvalidVersion1NotBeParsed() { Version.parse("invalid"); }
@Test(expected=IllegalArgumentException.class) public void shouldInvalidVersion2NotBeParsed() { Version.parse("a.2.3"); }