### Question:
MavenId implements Comparable<MavenId>, Cloneable { protected static Object[] getVersionComponents( String version ) { if (version == null) return new Object[] {}; version = version.trim(); if (version.length() == 0) return new Object[] {}; String[] parts = version.split("[\\.\\-/,]"); if (parts == null) return new Object[] {}; Object[] components = new Object[parts.length]; for (int i = 0, len = parts.length; i < len; i++) { String part = parts[i].trim(); Object component = part; try { component = Integer.parseInt(part); } catch (NumberFormatException e) { } components[i] = component; } return components; } MavenId( String coordinates );  MavenId( String groupId, String artifactId );  MavenId( String groupId, String artifactId, String version );  MavenId( String groupId, String artifactId, String version, String classifier ); static MavenId[] createClasspath( String commaSeparatedCoordinates ); static MavenId[] createClasspath( String... mavenCoordinates ); static MavenId[] createClasspath( MavenId... mavenIds ); String getGroupId(); String getArtifactId(); String getClassifier(); String getVersion(); String getRelativePath(); String getRelativePath( TextEncoder escapingStrategy ); String getRelativePath( boolean includeVersion ); String getRelativePath( TextEncoder escapingStrategy, boolean includeVersion ); String getCoordinates(); static MavenId createFromCoordinates( String coordinates ); @Override int hashCode(); @Override boolean equals( Object obj ); int compareTo( MavenId that ); @Override String toString(); @Override MavenId clone();  }### Answer:
@Test public void shouldParseValidVersionStringIntoComponents() { assertArrayEquals(new Object[] {1, 2}, MavenId.getVersionComponents("1.2")); assertArrayEquals(new Object[] {1, 2, 3, 4, 5, 6, 7, 8}, MavenId.getVersionComponents("1.2.3.4.5.6.7.8")); assertArrayEquals(new Object[] {1, 0, "SNAPSHOT"}, MavenId.getVersionComponents("1.0-SNAPSHOT")); assertArrayEquals(new Object[] {1, 0, "SNAPSHOT"}, MavenId.getVersionComponents("1.0,SNAPSHOT")); assertArrayEquals(new Object[] {1, 0, "SNAPSHOT"}, MavenId.getVersionComponents("1.0/SNAPSHOT")); assertArrayEquals(new Object[] {1, 0, "SNAPSHOT"}, MavenId.getVersionComponents("1.0-SNAPSHOT")); }
@Test public void shouldParseEmptyOrNullVersionStringIntoEmptyComponents() { assertArrayEquals(new Object[] {}, MavenId.getVersionComponents(null)); assertArrayEquals(new Object[] {}, MavenId.getVersionComponents("")); assertArrayEquals(new Object[] {}, MavenId.getVersionComponents(" ")); }
@Test public void shouldParseVersionStringWithEmbeddedWhitespaceIntoEmptyComponents() { assertArrayEquals(new Object[] {1, 2, "SNAPSHOT"}, MavenId.getVersionComponents(" 1.2-SNAPSHOT ")); assertArrayEquals(new Object[] {1, 2, "SNAPSHOT"}, MavenId.getVersionComponents(" 1 . 2 - SNAPSHOT ")); assertArrayEquals(new Object[] {1, 2, "SNAP SHOT"}, MavenId.getVersionComponents(" 1 . 2 - SNAP SHOT ")); }