ObjectsSectionProcessingStrategy implements ISectionStrategy { @Override public void onLoadConfig(final IObject config) throws ConfigurationProcessingException { try { List<IObject> section = (List<IObject>) config.getValue(name); for (IObject objDesc : section) { IReceiverObjectListener listener = IOC.resolve(Keys.getOrAdd("global router registration receiver object listener")); IReceiverObjectCreator creator = IOC.resolve(Keys.getOrAdd("full receiver object creator"), objDesc); IObject context = IOC.resolve(Keys.getOrAdd("info.smart_tools.smartactors.iobject.iobject.IObject")); creator.create(listener, objDesc, context); } } catch (InvalidReceiverPipelineException | ResolutionException | InvalidArgumentException | ReadValueException | ReceiverObjectCreatorException | ReceiverObjectListenerException e) { throw new ConfigurationProcessingException("Error occurred loading \"objects\" configuration section.", e); } } ObjectsSectionProcessingStrategy(); @Override void onLoadConfig(final IObject config); @Override IFieldName getSectionName();  }
@Test public void Should_createObjects() throws Exception { new ObjectsSectionProcessingStrategy().onLoadConfig(configMock); for (int i = 0; i < creatorMocks.length; i++) { verify(creatorMocks[i]).create(same(listenerMock), same(objectConfigMocks[i]), any()); } }
@Test(expected = ConfigurationProcessingException.class) public void Should_wrapCreationExceptions() throws Exception { doThrow(ReceiverObjectCreatorException.class).when(creatorMocks[0]).create(any(), any(), any()); new ObjectsSectionProcessingStrategy().onLoadConfig(configMock); }