### Question:
DefaultArtifact implements Artifact { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append( groupId ); sb.append( ':' ).append( artifactId ); sb.append( ':' ).append( extension ); if ( !classifier.isEmpty() ) sb.append( ':' ).append( classifier ); sb.append( ':' ).append( getVersion() ); return sb.toString(); } DefaultArtifact( String coords );  DefaultArtifact( String groupId, String artifactId );  DefaultArtifact( String groupId, String artifactId, String version );  DefaultArtifact( String groupId, String artifactId, String extension, String version );  DefaultArtifact( String groupId, String artifactId, String extension, String classifier, String version );  DefaultArtifact( String groupId, String artifactId, String extension, String classifier, String version,
                            Path path ); @Override String getGroupId(); @Override String getArtifactId(); @Override String getExtension(); @Override String getClassifier(); @Override String getVersion(); @Override Path getPath(); @Override Artifact setVersion( String version ); @Override Artifact setPath( Path path ); @Override String toString(); @Override boolean equals( Object rhs ); @Override int hashCode();  }### Answer:
@Test public void testToString() throws Exception { Artifact artifact2 = new DefaultArtifact( "gid", "aid" ); assertEquals( "gid:aid:jar:SYSTEM", artifact2.toString() ); Artifact artifact3 = new DefaultArtifact( "gid", "aid", "ver" ); assertEquals( "gid:aid:jar:ver", artifact3.toString() ); Artifact artifact4 = new DefaultArtifact( "gid", "aid", "ext", "ver" ); assertEquals( "gid:aid:ext:ver", artifact4.toString() ); Artifact artifact5 = new DefaultArtifact( "gid", "aid", "ext", "cla", "ver" ); assertEquals( "gid:aid:ext:cla:ver", artifact5.toString() ); }