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( "dependency1", "dependency2" );
48 String expected =
49 "Missing artifact" + LS + LS + " Try downloading the file manually from: " + LS
50 + " http://somewhere.com/download" + LS + LS + " Then, install it using the command: " + LS
51 + " mvn install:install-file -DgroupId=aGroupId -DartifactId=anArtifactId -Dversion=aVersion "
52 + "-Dclassifier=aClassifier -Dpackaging=jar -Dfile=/path/to/file" + LS + LS
53 + " Alternatively, if you host your own repository you can deploy the file there: " + LS
54 + " mvn deploy:deploy-file -DgroupId=aGroupId -DartifactId=anArtifactId"
55 + " -Dversion=aVersion -Dclassifier=aClassifier -Dpackaging=jar -Dfile=/path/to/file"
56 + " -Durl=[url] -DrepositoryId=[id]" + LS + LS + " Path to dependency: " + LS + " \t1) dependency1"
57 + LS + " \t2) dependency2" + LS + LS;
58 String actual =
59 AbstractArtifactResolutionException.constructMissingArtifactMessage( message, indentation, groupId,
60 artifactId, version, type, classifier,
61 downloadUrl, path );
62 assertEquals( expected, actual );
63 }
64 }