@Override protected void setUp() throws Exception { super.setUp(); resourceLoader = new ClassPathResourceLoader(); loader = new ModuleLocationsResourceLoader(); loader.setResourceLoader(resourceLoader); }
public final void testNotFound() { ModuleDefinition definition = new SimpleRootModuleDefinition(rootModuleName, new String[] {"unknown.xml"}); try { loader.getSpringLocations(definition, ClassUtils.getDefaultClassLoader()); fail(); } catch (ConfigurationException e) { assertEquals( "Unable to load resource from location 'unknown.xml' for module definition 'project1'", e.getMessage()); } }
public final void testApplicationModuleSpringLocationsResourceLoader() { ModuleDefinition definition = new SimpleRootModuleDefinition(rootModuleName, new String[] {"parentTestContext.xml"}); Resource[] springLocations = loader.getSpringLocations(definition, ClassUtils.getDefaultClassLoader()); assertEquals(1, springLocations.length); for (Resource resource : springLocations) { assertTrue(resource.exists()); assertTrue(resource instanceof ClassPathResource); } }