Version implements Comparable<Version> { @Override public String toString() { StringBuilder sb = new StringBuilder(); boolean first = true; for (int number : versionNumbers) { if (first) { first = false; } else { sb.append("."); } sb.append(Integer.toString(number)); } if (qualifier.isPresent()) { sb.append("-").append(qualifier.get()); } return sb.toString(); } private  Version(List<Integer> versionNumbers, Optional<String> qualifier); static Version parse(String versionString); int getMajorVersion(); @Override int compareTo(Version another); boolean isNewer(Version another); boolean isOlder(Version another); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testValidVersions() { assertValidVersion("0"); assertValidVersion("1"); assertValidVersion("10"); assertValidVersion("0.2"); assertValidVersion("0.23"); assertValidVersion("0.4.5"); assertValidVersion("0.4.56"); assertValidVersion("0.4.50"); assertValidVersion("0.0.6"); assertValidVersion("0.0.6.7"); assertValidVersion("8.9.10.11"); assertValidVersion("0-SNAPSHOT"); assertValidVersion("0.8.32-20170117T115910-a60cad1343c71489d752f39250470e10109e3425"); assertValidVersion(DigdagVersion.buildVersion().toString()); }