AutoConfigurationLoader { public void load(Object config) throws IOException { load(config, config.getClass().getAnnotation(AutoConfiguration.class)); } @Inject  AutoConfigurationLoader(ConfigLoader configLoader, TracerFactorySupplier tracerFactorySupplier); void load(Object config); void load(Object config, AutoConfiguration autoConfiguration);  }
@Test public void testLoadOptionalConfig() throws Exception { AutoConfigurationLoader autoConfigurationLoader = createAutoConfigurationLoader(); autoConfigurationLoader.load(new OptionalAutoConfiguration()); }
@Test public void testLoadRequiredConfig() throws Exception { AutoConfigurationLoader autoConfigurationLoader = createAutoConfigurationLoader(); autoConfigurationLoader.load(new RequiredAutoConfiguration()); }
@Test public void testAddress() throws Exception { AutoConfigurationLoader autoConfigurationLoader = createAutoConfigurationLoader(); AddressAutoConfiguration addressAutoConfiguration = new AddressAutoConfiguration(); autoConfigurationLoader.load(addressAutoConfiguration); assertEquals("AddressAutoConfiguration{name='John Smith', street='123 Fake Street', city='San Francisco', state='California'}", addressAutoConfiguration.toString()); }
@Test(expected = AutoConfigurationException.NotSingletonException.class) public void testNotSingletonAutoConfiguration() throws Exception { AutoConfigurationLoader autoConfigurationLoader = createAutoConfigurationLoader(); autoConfigurationLoader.load(new NotSingletonAutoConfiguration()); }
@Test(expected = AutoConfigurationException.MissingConfigException.class) public void testRequiredAutoWithWrongPathConfiguration() throws Exception { AutoConfigurationLoader autoConfigurationLoader = createAutoConfigurationLoader(); autoConfigurationLoader.load(new RequiredAutoWithWrongPathConfiguration()); }
@Test(expected = AutoConfigurationException.InvalidPathException.class) public void testLoadBrokenPathAutoConfiguration() throws Exception { AutoConfigurationLoader autoConfigurationLoader = createAutoConfigurationLoader(); autoConfigurationLoader.load(new BrokenPathAutoConfiguration()); }