]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc/src/main/java/org/argeo/slc/unit/SpringBasedTestCase.java
Documentation
[gpl/argeo-slc.git] / org.argeo.slc / src / main / java / org / argeo / slc / unit / SpringBasedTestCase.java
index f5ec0e17c2b13d908203671b0b7d17d86f54115e..b607825f0d1da23e9fa34d74b7cb1422b8327524 100644 (file)
@@ -5,6 +5,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
 \r
 import junit.framework.TestCase;\r
 \r
+/** Helper for tests using a Spring application co,text. */\r
 public class SpringBasedTestCase extends TestCase {\r
        private ApplicationContext context;\r
 \r
@@ -13,7 +14,7 @@ public class SpringBasedTestCase extends TestCase {
         * implementation uses a class path xml application context and calls\r
         * {@link #getApplicationContextLocation()}.\r
         */\r
-       protected ApplicationContext getApplicationContext() {\r
+       protected ApplicationContext getContext() {\r
                if (context == null) {\r
                        context = new ClassPathXmlApplicationContext(\r
                                        getApplicationContextLocation());\r
@@ -22,15 +23,20 @@ public class SpringBasedTestCase extends TestCase {
        }\r
 \r
        /**\r
-        * Get the application context location used by the default implementation\r
-        * of {@link #getApplicationContext()}.\r
+        * Th location of the application to load. The default implementation\r
+        * returns <i>applicationContext.xml</i> found in the same package as the\r
+        * test.\r
         */\r
        protected String getApplicationContextLocation() {\r
                return inPackage("applicationContext.xml");\r
        }\r
-       \r
-       protected String inPackage(String suffix){\r
+\r
+       /**\r
+        * Prefixes the package of the class after converting the '.' to '/' in\r
+        * order to have a resource path.\r
+        */\r
+       protected String inPackage(String suffix) {\r
                String prefix = getClass().getPackage().getName().replace('.', '/');\r
-               return prefix+'/'+suffix;\r
+               return prefix + '/' + suffix;\r
        }\r
 }\r