### Question:
StrutsJavaConfigurationProvider implements ConfigurationProvider { @Override public void register(ContainerBuilder builder, LocatableProperties props) throws ConfigurationException { Map<String, Object> loadedBeans = new HashMap<>(); List<BeanConfig> beanConfigs = javaConfig.beans(); if (beanConfigs != null) { for (BeanConfig bc : beanConfigs) { if (bc != null) { registerBean(loadedBeans, builder, bc); } } } List<ConstantConfig> constantConfigList = javaConfig.constants(); if (constantConfigList != null) { for (ConstantConfig constantConf : constantConfigList) { if (constantConf != null) { Map<String, String> constantMap = constantConf.getAllAsStringsMap(); for (Entry<String, String> entr : constantMap.entrySet()) { if (entr.getKey() != null && entr.getValue() != null) { registerConstant(props, entr.getKey(), entr.getValue()); } } } } } javaConfig.beanSelection().ifPresent(beanSelectionConfig -> { try { LOG.debug("Registering bean selection provider {} of type {}", beanSelectionConfig.getName(), beanSelectionConfig.getClazz().getName()); BeanSelectionProvider provider = beanSelectionConfig.getClazz().newInstance(); provider.register(builder, props); } catch (IllegalAccessException | InstantiationException e) { throw new ConfigurationException("Unable to load : name:" + beanSelectionConfig.getName() + " class:" + beanSelectionConfig.getClazz().getName()); } }); List<String> unknownHandlers = javaConfig.unknownHandlerStack(); if (unknownHandlers != null) { List<UnknownHandlerConfig> unknownHandlerStack = new ArrayList<>(); for (String unknownHandler : unknownHandlers) { Location location = LocationUtils.getLocation(unknownHandler); unknownHandlerStack.add(new UnknownHandlerConfig(unknownHandler, location)); } if (!unknownHandlerStack.isEmpty()) { configuration.setUnknownHandlerStack(unknownHandlerStack); } } } StrutsJavaConfigurationProvider(StrutsJavaConfiguration javaConfig); void setThrowExceptionOnDuplicateBeans(boolean val); @Inject(required = false) void setValueSubstitutor(ValueSubstitutor valueSubstitutor); @Override void register(ContainerBuilder builder, LocatableProperties props); @Override void init(Configuration configuration); @Override boolean needsReload(); @Override void loadPackages(); @Override void destroy();  }### Answer:
@Test public void testRegister() throws Exception { final ConstantConfig constantConfig = new ConstantConfig(); constantConfig.setDevMode(true); final String expectedUnknownHandler = "expectedUnknownHandler"; StrutsJavaConfiguration javaConfig = new StrutsJavaConfiguration() { @Override public List<String> unknownHandlerStack() { return Collections.singletonList(expectedUnknownHandler); } @Override public List<ConstantConfig> constants() { return Collections.singletonList(constantConfig); } @Override public List<BeanConfig> beans() { return Arrays.asList( new BeanConfig(TestBean.class, "struts"), new BeanConfig(TestBean.class, "struts.static", TestBean.class, Scope.PROTOTYPE, true, true), new BeanConfig(TestBean.class, "struts.test.bean", TestBean.class) ); } @Override public Optional<BeanSelectionConfig> beanSelection() { return Optional.of(new BeanSelectionConfig(TestBeanSelectionProvider.class, "testBeans")); } }; StrutsJavaConfigurationProvider provider = new StrutsJavaConfigurationProvider(javaConfig); Configuration configuration = new MockConfiguration(); provider.init(configuration); ContainerBuilder builder = new ContainerBuilder(); LocatableProperties props = new LocatableProperties(); provider.register(builder, props); Assert.assertEquals(String.valueOf(constantConfig.getDevMode()), props.get(StrutsConstants.STRUTS_DEVMODE)); Assert.assertNotNull(configuration.getUnknownHandlerStack()); Assert.assertEquals(1, configuration.getUnknownHandlerStack().size()); Assert.assertEquals(expectedUnknownHandler, configuration.getUnknownHandlerStack().get(0).getName()); Container container = builder.create(true); TestBean testBean = container.getInstance(TestBean.class); Assert.assertNotNull(testBean); testBean = container.getInstance(TestBean.class, "struts"); Assert.assertNotNull(testBean); Set<String> names = container.getInstanceNames(TestBean.class); Assert.assertTrue(names.contains("struts")); Assert.assertTrue(names.contains("struts.test.bean")); }