### Question:
DefaultArtifact implements Artifact { @Override public boolean equals( Object rhs ) { if ( !( rhs instanceof Artifact ) ) return false; Artifact x = (Artifact) rhs; return groupId.equals( x.getGroupId() ) && artifactId.equals( x.getArtifactId() ) && extension.equals( x.getExtension() ) && classifier.equals( x.getClassifier() ) && version.equals( x.getVersion() ) && ( path == null ? x.getPath() == null : path.equals( x.getPath() ) ); } 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 testEquals() throws Exception { Artifact artifact = new DefaultArtifact( "gid", "aid", "ext", "cla", "ver" ); assertTrue( artifact.equals( artifact ) ); assertFalse( artifact.equals( null ) ); assertFalse( artifact.equals( 42 ) ); Artifact artifact0 = new DefaultArtifact( "gid:aid:ext:cla:ver" ); assertTrue( artifact.equals( artifact0 ) ); Artifact artifact1 = new DefaultArtifact( "gidX", "aid", "ext", "cla", "ver" ); Artifact artifact2 = new DefaultArtifact( "gid", "aidX", "ext", "cla", "ver" ); Artifact artifact3 = new DefaultArtifact( "gid", "aid", "extX", "cla", "ver" ); Artifact artifact4 = new DefaultArtifact( "gid", "aid", "ext", "claX", "ver" ); Artifact artifact5 = new DefaultArtifact( "gid", "aid", "ext", "cla", "verX" ); assertFalse( artifact.equals( artifact1 ) ); assertFalse( artifact.equals( artifact2 ) ); assertFalse( artifact.equals( artifact3 ) ); assertFalse( artifact.equals( artifact4 ) ); assertFalse( artifact.equals( artifact5 ) ); }