ArtifacIdUtils { public static String toId( Artifact artifact ) { String id = null; if ( artifact != null ) { id = toId( artifact.getGroupId(), artifact.getArtifactId(), artifact.getExtension(), artifact.getClassifier(), artifact.getVersion() ); } return id; } private  ArtifacIdUtils(); static String toId( Artifact artifact ); static String toId( String groupId, String artifactId, String extension, String classifier, String version ); static String toBaseId( Artifact artifact ); static String toVersionlessId( Artifact artifact ); static String toVersionlessId( String groupId, String artifactId, String extension, String classifier );  }
@Test public void testToIdArtifact() { Artifact artifact = null; assertSame( null, ArtifacIdUtils.toId( artifact ) ); artifact = new DefaultArtifact( "gid", "aid", "ext", "1.0-20110205.132618-23" ); assertEquals( "gid:aid:ext:1.0-20110205.132618-23", ArtifacIdUtils.toId( artifact ) ); artifact = new DefaultArtifact( "gid", "aid", "cls", "ext", "1.0-20110205.132618-23" ); assertEquals( "gid:aid:ext:cls:1.0-20110205.132618-23", ArtifacIdUtils.toId( artifact ) ); }
@Test public void testToIdStrings() { assertEquals( ":::", ArtifacIdUtils.toId( null, null, null, null, null ) ); assertEquals( "gid:aid:ext:1", ArtifacIdUtils.toId( "gid", "aid", "ext", "", "1" ) ); assertEquals( "gid:aid:ext:cls:1", ArtifacIdUtils.toId( "gid", "aid", "ext", "cls", "1" ) ); }