Hi,
is a better way of getting the application context while junit testing than the following:
Code:protected static ApplicationContext ctx; public static ApplicationContext getApplicationContext() { if (Application.isLoaded()) { // normal apps life ctx = Application.instance().getApplicationContext(); } else { // unit testing ctx = new ClassPathXmlApplicationContext( new String[]{"/de/timefinder/core/ctx/application-context.xml"}); } return ctx; }


Reply With Quote