GenericDecoratorReceiverObjectCreator extends BasicIntermediateReceiverObjectCreator { @Override public void acceptItem(final Object itemId, final Object item) throws ReceiverObjectListenerException, InvalidReceiverPipelineException, InvalidArgumentException { Object decorator; try { decorator = IOC.resolve( IOC.resolve(IOC.getKeyForKeyStorage(), getFilterConfig().getValue(decoratorDependencyFieldName)), item, getFilterConfig(), getObjectConfig(), getContext() ); } catch (ResolutionException | ReadValueException | InvalidArgumentException e) { throw new ReceiverObjectListenerException("Error occurred creating receiver decorator.", e); } getListener().acceptItem(itemId, decorator); } GenericDecoratorReceiverObjectCreator(
            final IReceiverObjectCreator underlyingObjectCreator, final IObject filterConfig, final IObject objectConfig); @Override void acceptItem(final Object itemId, final Object item);  }
@Test public void Should_createAndReturnDecorator() throws Exception { IReceiverObjectCreator tested = new GenericDecoratorReceiverObjectCreator(creatorMock, filterConfig, objectConfig); tested.create(listenerMock, objectConfig, context); verify(listenerMock).acceptItem(eq("foo"), same(receiverMocks[1])); verify(listenerMock).endItems(); verifyNoMoreInteractions(listenerMock); }