1 package org.apache.maven.artifact.resolver;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.Arrays;
23 import java.util.List;
24
25 import junit.framework.TestCase;
26
27
28
29
30
31
32 public class ArtifactResolutionExceptionTest
33 extends TestCase
34 {
35 private static final String LS = System.getProperty( "line.separator" );
36
37 public void testMissingArtifactMessageFormat()
38 {
39 String message = "Missing artifact";
40 String indentation = " ";
41 String groupId = "aGroupId";
42 String artifactId = "anArtifactId";
43 String version = "aVersion";
44 String type = "jar";
45 String classifier = "aClassifier";
46 String downloadUrl = "http://somewhere.com/download";
47 List path = Arrays.asList(new String[]{"dependency1", "dependency2"});
48 String expected = "Missing artifact" + LS +
49 LS +
50 " Try downloading the file manually from: " + LS +
51 " http://somewhere.com/download" + LS +
52 LS +
53 " Then, install it using the command: " + LS +
54 " mvn install:install-file -DgroupId=aGroupId -DartifactId=anArtifactId -Dversion=aVersion "+
55 "-Dclassifier=aClassifier -Dpackaging=jar -Dfile=/path/to/file" + LS +
56 LS +
57 " Alternatively, if you host your own repository you can deploy the file there: " + LS +
58 " mvn deploy:deploy-file -DgroupId=aGroupId -DartifactId=anArtifactId"+
59 " -Dversion=aVersion -Dclassifier=aClassifier -Dpackaging=jar -Dfile=/path/to/file"+
60 " -Durl=[url] -DrepositoryId=[id]" + LS +
61 LS +
62 " Path to dependency: " + LS +
63 " \t1) dependency1" + LS +
64 " \t2) dependency2" + LS +
65 LS;
66 String actual = AbstractArtifactResolutionException.constructMissingArtifactMessage(message, indentation, groupId, artifactId, version, type, classifier, downloadUrl, path);
67 assertEquals(expected, actual);
68 }
69 }