]> source.dussan.org Git - archiva.git/blob
0fb6e917e8cf48080c77dac2555595cba6f1b79d
[archiva.git] /
1 package org.apache.archiva.rest.services.utils;
2 /*
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  */
20
21 import static org.assertj.core.api.Assertions.*;
22
23 import java.io.File;
24 import java.nio.file.Paths;
25
26 import org.easymock.TestSubject;
27 import org.junit.Test;
28
29 public class ArtifactBuilderTest
30 {
31     @TestSubject
32     private ArtifactBuilder builder = new ArtifactBuilder();
33
34     @Test
35     public void testBuildSnapshot()
36     {
37         assertThat( builder.getExtensionFromFile( Paths.get( "/tmp/foo-2.3-20141119.064321-40.jar" ) ) ).isEqualTo( "jar" );
38     }
39
40     @Test
41     public void testBuildPom()
42     {
43         assertThat( builder.getExtensionFromFile( Paths.get( "/tmp/foo-1.0.pom" ) ) ).isEqualTo( "pom" );
44     }
45
46     @Test
47     public void testBuildJar()
48     {
49         assertThat( builder.getExtensionFromFile( Paths.get( "/tmp/foo-1.0-sources.jar" ) ) ).isEqualTo( "jar" );
50     }
51
52     @Test
53     public void testBuildTarGz()
54     {
55         assertThat( builder.getExtensionFromFile( Paths.get( "/tmp/foo-1.0.tar.gz" ) ) ).isEqualTo( "tar.gz" );
56     }
57
58     @Test
59     public void testBuildPomZip()
60     {
61         assertThat( builder.getExtensionFromFile( Paths.get( "/tmp/foo-1.0.pom.zip" ) ) ).isEqualTo( "pom.zip" );
62     }
63
64     @Test
65     public void testBuildR00()
66     {
67         assertThat( builder.getExtensionFromFile( Paths.get( "/tmp/foo-1.0.r00" ) ) ).isEqualTo( "r00" );
68     }
69 }