\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
* 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
}\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