1 package org.apache.archiva.rest.services.utils;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import static org.assertj.core.api.Assertions.*;
22
23 import java.io.File;
24
25 import org.easymock.TestSubject;
26 import org.junit.Test;
27
28 public class ArtifactBuilderTest
29 {
30 @TestSubject
31 private ArtifactBuilder builder = new ArtifactBuilder();
32
33 @Test
34 public void testBuildSnapshot()
35 {
36 assertThat( builder.getExtensionFromFile( new File( "/tmp/foo-2.3-20141119.064321-40.jar" ) ) ).isEqualTo( "jar" );
37 }
38
39 @Test
40 public void testBuildPom()
41 {
42 assertThat( builder.getExtensionFromFile( new File( "/tmp/foo-1.0.pom" ) ) ).isEqualTo( "pom" );
43 }
44
45 @Test
46 public void testBuildJar()
47 {
48 assertThat( builder.getExtensionFromFile( new File( "/tmp/foo-1.0-sources.jar" ) ) ).isEqualTo( "jar" );
49 }
50
51 @Test
52 public void testBuildTarGz()
53 {
54 assertThat( builder.getExtensionFromFile( new File( "/tmp/foo-1.0.tar.gz" ) ) ).isEqualTo( "tar.gz" );
55 }
56
57 @Test
58 public void testBuildPomZip()
59 {
60 assertThat( builder.getExtensionFromFile( new File( "/tmp/foo-1.0.pom.zip" ) ) ).isEqualTo( "pom.zip" );
61 }
62
63 @Test
64 public void testBuildR00()
65 {
66 assertThat( builder.getExtensionFromFile( new File( "/tmp/foo-1.0.r00" ) ) ).isEqualTo( "r00" );
67 }
68 }