SubArtifact extends AbstractArtifact { public String getExtension() { return expand( extension, mainArtifact.getExtension() ); } SubArtifact( Artifact mainArtifact, String classifier, String extension );  SubArtifact( Artifact mainArtifact, String classifier, String extension, File file );  SubArtifact( Artifact mainArtifact, String classifier, String extension, Map<String, String> properties );  SubArtifact( Artifact mainArtifact, String classifier, String extension, Map<String, String> properties,
                        File file ); private  SubArtifact( Artifact mainArtifact, String classifier, String extension, File file,
                         Map<String, String> properties ); String getGroupId(); String getArtifactId(); String getVersion(); Artifact setVersion( String version ); String getBaseVersion(); boolean isSnapshot(); String getClassifier(); String getExtension(); File getFile(); Artifact setFile( File file ); String getProperty( String key, String defaultValue ); Map<String, String> getProperties(); Artifact setProperties( Map<String, String> properties );  }
@Test public void testEmptyExtension() { Artifact main = newMainArtifact( "gid:aid:ext:cls:ver" ); Artifact sub = new SubArtifact( main, "tests", "" ); assertEquals( "", sub.getExtension() ); sub = new SubArtifact( main, "tests", null ); assertEquals( "", sub.getExtension() ); }
@Test public void testSameExtension() { Artifact main = newMainArtifact( "gid:aid:ext:cls:ver" ); Artifact sub = new SubArtifact( main, "tests", "*" ); assertEquals( "ext", sub.getExtension() ); }
@Test public void testDerivedExtension() { Artifact main = newMainArtifact( "gid:aid:ext:cls:ver" ); Artifact sub = new SubArtifact( main, "", "*.asc" ); assertEquals( "ext.asc", sub.getExtension() ); sub = new SubArtifact( main, "", "asc.*" ); assertEquals( "asc.ext", sub.getExtension() ); }