@Test public void greaterTest() { assertThat(RobotVersion.from("1.2")).isGreaterThan(RobotVersion.from("1.0")); assertThat(RobotVersion.from("1.2")).isGreaterThan(RobotVersion.from("0.1.1")); assertThat(RobotVersion.from("1.2")).isGreaterThan(RobotVersion.from("0.1")); assertThat(RobotVersion.from("1.2")).isGreaterThan(RobotVersion.from("1.1")); assertThat(RobotVersion.from("1.2")).isGreaterThan(RobotVersion.from("1.1.9")); }
public static RobotVersion from(final String version) { if (version == null) { return UNKNOWN; } final Matcher matcher = Pattern.compile("(\\d)\\.(\\d+)(\\.(\\d+))?").matcher(version); if (matcher.find()) { if (matcher.group(4) == null) { return new RobotVersion(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2))); } else { return new RobotVersion(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(4))); } } throw new IllegalStateException("Unable to recognize Robot Framework version number"); }
RobotVersion implements Comparable<RobotVersion> { public static RobotVersion from(final String version) { if (version == null) { return UNKNOWN; } final Matcher matcher = Pattern.compile("(\\d)\\.(\\d+)(\\.(\\d+))?").matcher(version); if (matcher.find()) { if (matcher.group(4) == null) { return new RobotVersion(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2))); } else { return new RobotVersion(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(4))); } } throw new IllegalStateException("Unable to recognize Robot Framework version number"); } }
RobotVersion implements Comparable<RobotVersion> { public static RobotVersion from(final String version) { if (version == null) { return UNKNOWN; } final Matcher matcher = Pattern.compile("(\\d)\\.(\\d+)(\\.(\\d+))?").matcher(version); if (matcher.find()) { if (matcher.group(4) == null) { return new RobotVersion(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2))); } else { return new RobotVersion(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(4))); } } throw new IllegalStateException("Unable to recognize Robot Framework version number"); } RobotVersion(final int major, final int minor);  RobotVersion(final int major, final int minor, final int patch); }
RobotVersion implements Comparable<RobotVersion> { public static RobotVersion from(final String version) { if (version == null) { return UNKNOWN; } final Matcher matcher = Pattern.compile("(\\d)\\.(\\d+)(\\.(\\d+))?").matcher(version); if (matcher.find()) { if (matcher.group(4) == null) { return new RobotVersion(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2))); } else { return new RobotVersion(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(4))); } } throw new IllegalStateException("Unable to recognize Robot Framework version number"); } RobotVersion(final int major, final int minor);  RobotVersion(final int major, final int minor, final int patch); static RobotVersion from(final String version); boolean isEqualTo(final RobotVersion otherVersion); boolean isNotEqualTo(final RobotVersion otherVersion); boolean isOlderThan(final RobotVersion otherVersion); boolean isOlderThanOrEqualTo(final RobotVersion otherVersion); boolean isNewerThan(final RobotVersion otherVersion); boolean isNewerOrEqualTo(final RobotVersion otherVersion); boolean isDeprecated(); @Override int compareTo(final RobotVersion otherVersion); @Override boolean equals(final Object obj); @Override int hashCode(); String asString(); @Override String toString(); }
RobotVersion implements Comparable<RobotVersion> { public static RobotVersion from(final String version) { if (version == null) { return UNKNOWN; } final Matcher matcher = Pattern.compile("(\\d)\\.(\\d+)(\\.(\\d+))?").matcher(version); if (matcher.find()) { if (matcher.group(4) == null) { return new RobotVersion(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2))); } else { return new RobotVersion(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(4))); } } throw new IllegalStateException("Unable to recognize Robot Framework version number"); } RobotVersion(final int major, final int minor);  RobotVersion(final int major, final int minor, final int patch); static RobotVersion from(final String version); boolean isEqualTo(final RobotVersion otherVersion); boolean isNotEqualTo(final RobotVersion otherVersion); boolean isOlderThan(final RobotVersion otherVersion); boolean isOlderThanOrEqualTo(final RobotVersion otherVersion); boolean isNewerThan(final RobotVersion otherVersion); boolean isNewerOrEqualTo(final RobotVersion otherVersion); boolean isDeprecated(); @Override int compareTo(final RobotVersion otherVersion); @Override boolean equals(final Object obj); @Override int hashCode(); String asString(); @Override String toString(); static final RobotVersion UNKNOWN; }