KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > test > MagnoliaTestUtils


1 package info.magnolia.test;
2
3 import java.io.File JavaDoc;
4
5
6 /**
7  * Utility methods that can be used in JUnit test cases.
8  * @author fgiust
9  * @version $Revision: $ ($Author: $)
10  */

11 public final class MagnoliaTestUtils {
12
13     /**
14      * Utility class, don't instantiate.
15      */

16     private MagnoliaTestUtils() {
17         // unused
18
}
19
20     /**
21      * Returns the root directory path for project sources.
22      * @return root directory path for test resources
23      * @todo should use a better way to determine the project root
24      */

25     public static String JavaDoc getProjectRoot() {
26
27         return new File JavaDoc(MagnoliaTestUtils.class.getResource("/test-resources.dir").getFile())
28             .getParentFile()
29             .getParentFile()
30             .getParent();
31     }
32
33     /**
34      * Returns the root directory path for test resources.
35      * @return root directory path for test resources
36      */

37     public static String JavaDoc getTestResourcesDir() {
38         return new File JavaDoc(MagnoliaTestUtils.class.getResource("/test-resources.dir").getFile()).getParent();
39     }
40
41 }
42
Popular Tags