1 package org.apache.maven.util;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import java.io.File;
22
23 import junit.framework.Test;
24 import junit.framework.TestCase;
25 import junit.framework.TestSuite;
26
27 /**
28 * Unit test for <code>MavenTool</code>.
29 *
30 * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
31 * @version $Id: MavenToolTest.java 517014 2007-03-11 21:15:50Z ltheussl $
32 */
33 public class MavenToolTest
34 extends TestCase
35 {
36 /** fragment to be resolved */
37 private static final String NEEDLE = "org/apache/maven/util/MavenTool.java";
38
39 /** where to search for the fragment */
40 private static final String[] HAYSTACK = { "docs", "src" + File.separator + "java", "xdocs" };
41
42 /**
43 * Create the test with the given name
44 *
45 * @param testName the name of the test
46 */
47 public MavenToolTest( String testName )
48 {
49 super( testName );
50 }
51
52 /**
53 * @return the suite of tests being tested
54 */
55 public static Test suite()
56 {
57 return new TestSuite( MavenToolTest.class );
58 }
59
60 /**
61 * Tests {@link MavenTool.resolvePathFragment(String, String, String[])}.
62 */
63 public void testResolvePathFragment()
64 {
65 MavenTool tool = new MavenTool();
66
67
68
69
70
71 String basedir = System.getProperty( "basedir" );
72 assertNotNull( "The system property basedir was not defined.", basedir );
73
74 String path = tool.resolvePathFragment( basedir, NEEDLE, HAYSTACK );
75 assertEquals( "Couldn't resolve fragment using a base directory of " + basedir, HAYSTACK[1], path );
76 }
77 }