### Question:
ArtifactBuilder { String getExtensionFromFile( StorageAsset file ) { String[] parts = file.getName().split( "-" ); if ( parts.length > 0 ) { Pattern p = Pattern.compile( "\\.([a-z]+[a-z0-9\\.]*)" ); Matcher m = p.matcher( parts[parts.length - 1] ); if ( m.find() ) { return m.group( 1 ); } } return StorageUtil.getExtension( file ); } ArtifactBuilder(); ArtifactBuilder withManagedRepositoryContent( ManagedRepositoryContent managedRepositoryContent ); ArtifactBuilder forArtifactMetadata( ArtifactMetadata artifactMetadata ); Artifact build();  }### Answer:
@Test public void testBuildSnapshot() throws IOException { assertThat( builder.getExtensionFromFile( getFile( "/tmp/foo-2.3-20141119.064321-40.jar" ) ) ).isEqualTo( "jar" ); }
@Test public void testBuildPom() throws IOException { assertThat( builder.getExtensionFromFile( getFile( "/tmp/foo-1.0.pom" ) ) ).isEqualTo( "pom" ); }
@Test public void testBuildJar() throws IOException { assertThat( builder.getExtensionFromFile( getFile( "/tmp/foo-1.0-sources.jar" ) ) ).isEqualTo( "jar" ); }
@Test public void testBuildTarGz() throws IOException { assertThat( builder.getExtensionFromFile( getFile( "/tmp/foo-1.0.tar.gz" ) ) ).isEqualTo( "tar.gz" ); }
@Test public void testBuildPomZip() throws IOException { assertThat( builder.getExtensionFromFile( getFile( "/tmp/foo-1.0.pom.zip" ) ) ).isEqualTo( "pom.zip" ); }
@Test public void testBuildR00() throws IOException { assertThat( builder.getExtensionFromFile( getFile( "/tmp/foo-1.0.r00" ) ) ).isEqualTo( "r00" ); }