MavenCoordinates { public static MavenCoordinates fromGAV(String coordinates) { return fromGAV(coordinates, null); } MavenCoordinates(String groupId, String artifactId, String version, String packaging, String classifier, String fileVersion); static MavenCoordinates fromConfigGAV(String configSpec); static MavenCoordinates fromBinaryGAV(String configSpec); static MavenCoordinates fromGAV(String coordinates); static String toConfigGAV(MavenCoordinates configSpec); static String toBinaryGAV(MavenCoordinates binarySpec); String toGAV(@Nullable String defaultPackaging, boolean showFullVersion); String getGroupId(); String getArtifactId(); String getPackaging(); String getClassifier(); String getVersion(); String getFileVersion(); boolean isResolved(); boolean equalsIgnoreVersion(MavenCoordinates that); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); String toGAV(); static final String DEFAULT_CONFIG_PACKAGING; static final String DEFAULT_BINARY_PACKAGING; }
@Test public void simpleCoordinates() { Assert.assertNull(MavenCoordinates.fromGAV("my.groupId:artifactId:version")); }
@Test public void shortCoordinates() { Assert.assertNull(MavenCoordinates.fromGAV("my.groupId:artifactId:version")); }
@Test public void bogusCoordinates() { Assert.assertNull(MavenCoordinates.fromGAV("bogus")); Assert.assertNull(MavenCoordinates.fromGAV("1:2:3:4:5:6:7:8:9:0")); }
@Test public void testEquivalence() { EquivalenceTester.equivalenceTester() .addEquivalentGroup( MavenCoordinates.fromGAV("my.group:artifactId:packaging:version"), new MavenCoordinates("my.group", "artifactId", "version", "packaging", null, null)) .addEquivalentGroup( MavenCoordinates.fromGAV("my.group:artifactId:packaging:classifier:version"), new MavenCoordinates("my.group", "artifactId", "version", "packaging", "classifier", null)) .check(); }