@Test(expected = Exception.class) public void testNotFound() throws Exception { context.checking(new Expectations() { { allowing(resource).exists(); will(returnValue(false)); } }); sut.afterPropertiesSet(); context.assertIsSatisfied(); }
@Override public void afterPropertiesSet() throws Exception { Resource resource = resourceLoader.getResource(resourcePath); if (!resource.exists()) { throw new FileNotFoundException("Required properties file resource '" + resourcePath + "' not found."); } properties = new Properties(); InputStream stream = resource.getInputStream(); try { properties.load(stream); } finally { stream.close(); } }
ResourcePropertyFileLoaderFactoryBean implements FactoryBean, InitializingBean, ResourceLoaderAware { @Override public void afterPropertiesSet() throws Exception { Resource resource = resourceLoader.getResource(resourcePath); if (!resource.exists()) { throw new FileNotFoundException("Required properties file resource '" + resourcePath + "' not found."); } properties = new Properties(); InputStream stream = resource.getInputStream(); try { properties.load(stream); } finally { stream.close(); } } }
ResourcePropertyFileLoaderFactoryBean implements FactoryBean, InitializingBean, ResourceLoaderAware { @Override public void afterPropertiesSet() throws Exception { Resource resource = resourceLoader.getResource(resourcePath); if (!resource.exists()) { throw new FileNotFoundException("Required properties file resource '" + resourcePath + "' not found."); } properties = new Properties(); InputStream stream = resource.getInputStream(); try { properties.load(stream); } finally { stream.close(); } } ResourcePropertyFileLoaderFactoryBean(final String inResourcePath); }
ResourcePropertyFileLoaderFactoryBean implements FactoryBean, InitializingBean, ResourceLoaderAware { @Override public void afterPropertiesSet() throws Exception { Resource resource = resourceLoader.getResource(resourcePath); if (!resource.exists()) { throw new FileNotFoundException("Required properties file resource '" + resourcePath + "' not found."); } properties = new Properties(); InputStream stream = resource.getInputStream(); try { properties.load(stream); } finally { stream.close(); } } ResourcePropertyFileLoaderFactoryBean(final String inResourcePath); @Override Object getObject(); @Override Class getObjectType(); @Override boolean isSingleton(); @Override void afterPropertiesSet(); @Override void setResourceLoader(final ResourceLoader inResourceLoader); }
ResourcePropertyFileLoaderFactoryBean implements FactoryBean, InitializingBean, ResourceLoaderAware { @Override public void afterPropertiesSet() throws Exception { Resource resource = resourceLoader.getResource(resourcePath); if (!resource.exists()) { throw new FileNotFoundException("Required properties file resource '" + resourcePath + "' not found."); } properties = new Properties(); InputStream stream = resource.getInputStream(); try { properties.load(stream); } finally { stream.close(); } } ResourcePropertyFileLoaderFactoryBean(final String inResourcePath); @Override Object getObject(); @Override Class getObjectType(); @Override boolean isSingleton(); @Override void afterPropertiesSet(); @Override void setResourceLoader(final ResourceLoader inResourceLoader);  }