### Question:
Version implements Comparable<Version>, Serializable { public static Version of(@NotNull final String string) { ArrayList<Integer> b = new ArrayList<Integer>(5); final String[] substrings = string.split("[.,\\-_ ]|(?<=\\d)(?!\\d)|(?<!\\d)(?=\\d)"); for (String ss : substrings) { String ss2 = ss.trim().toLowerCase(Locale.ENGLISH); if (ss2.isEmpty()) continue; Integer special = SPECIAL_VALUES.get(ss2); if (special != null) b.add(special); else { try { Integer v = new Integer(ss2); b.add(v); } catch (NumberFormatException e) { break; } } } if (b.isEmpty()) throw new IllegalArgumentException("Failed to parse version \""+string+"\""); if (b.size() == 1 && b.get(0) == 0) return ZERO; return of(b.toArray(new Integer[b.size()])); } private  Version(@NotNull final int[] elements); static Version of(@NotNull final String string); static Version of(@NotNull final int... elements); static Version of(@NotNull final Integer[] elements); int get(int index); int size(); @NotNull Version truncate(final int n); @NotNull Version truncateNegatives(); int compareTo(@NotNull final Version that); int compareTo(final int... that); boolean isOrGreater(final int... than); boolean isOrGreater(@NotNull final Version than); boolean less(final int... than); boolean less(@NotNull final Version than); @Override boolean equals(final Object o); @Override int hashCode(); @NotNull String toString(); @NotNull String toString(int minimumElements, int maximumElements); @NotNull int[] toArray(); static final Version ZERO; }### Answer:
@Test public void parse_currentJavaVersion() { Version.of(System.getProperty("java.runtime.version")); }
@Test public void equal_zeros() { Version v1 = Version.of(1,2,3), v2 = Version.of(1,2,3,0,0); assertThat(v2).isEqualTo(v1); assertThat(v1).isEqualTo(v2); }
@Test public void equal_zeros_and_empty() { Version v1 = Version.of(), v2 = Version.of(0,0,0); assertThat(v2).isEqualTo(v1); assertThat(v1).isEqualTo(v2); }