Commit 3d99a5dd authored by Dave Syer's avatar Dave Syer

Add test for inaccessible configuration class

See gh-948
parent f1f36cd0
......@@ -110,6 +110,13 @@ public class SpringApplicationTests {
new SpringApplication().run();
}
@Test
public void sourcesMustBeAccessible() throws Exception {
this.thrown.expect(IllegalStateException.class);
this.thrown.expectMessage("Cannot load configuration");
new SpringApplication(InaccessibleConfiguration.class).run();
}
@Test
public void disableBanner() throws Exception {
SpringApplication application = spy(new SpringApplication(ExampleConfig.class));
......@@ -269,7 +276,7 @@ public class SpringApplicationTests {
}
@Test
public void proprtiesFileEnhancesEnvironment() throws Exception {
public void propertiesFileEnhancesEnvironment() throws Exception {
SpringApplication application = new SpringApplication(ExampleConfig.class);
application.setWebEnvironment(false);
ConfigurableEnvironment environment = new StandardEnvironment();
......@@ -468,6 +475,14 @@ public class SpringApplicationTests {
return false;
}
@Configuration
protected static class InaccessibleConfiguration {
private InaccessibleConfiguration() {
}
}
public static class SpyApplicationContext extends AnnotationConfigApplicationContext {
ConfigurableApplicationContext applicationContext = spy(new AnnotationConfigApplicationContext());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment