1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.resolver.internal.ant.tasks;
20
21 import junit.framework.JUnit4TestAdapter;
22 import org.apache.tools.ant.BuildException;
23 import org.eclipse.aether.artifact.DefaultArtifact;
24 import org.junit.Test;
25
26 import static org.junit.Assert.assertEquals;
27
28
29
30 public class LayoutTest {
31 public static junit.framework.Test suite() {
32 return new JUnit4TestAdapter(LayoutTest.class);
33 }
34
35 @Test(expected = BuildException.class)
36 public void testUnknownVariable() {
37 new Layout("{unknown}");
38 }
39
40 @Test
41 public void testGetPath() {
42 Layout layout;
43
44 layout = new Layout("{groupIdDirs}/{artifactId}/{baseVersion}/{artifactId}-{version}-{classifier}.{extension}");
45 assertEquals(
46 "org/apache/maven/maven-model/3.0-SNAPSHOT/maven-model-3.0-20100720.132618-1.jar",
47 layout.getPath(new DefaultArtifact("org.apache.maven:maven-model:3.0-20100720.132618-1")));
48
49 layout = new Layout("{groupId}/{artifactId}-{version}-{classifier}.{extension}");
50 assertEquals(
51 "org.apache.maven/maven-model-3.0-sources.jar",
52 layout.getPath(new DefaultArtifact("org.apache.maven:maven-model:jar:sources:3.0")));
53 }
54 }