@Test
public void testDoProcessing() throws Exception {

	PMode pmode = TestUtils.create1WaySendPushPMode();        
    Leg leg = pmode.getLeg(Label.REQUEST);
    
    UserMessageFlow umFlow = new UserMessageFlow();
    ErrorHandlingConfig errorHandlingConfig = new ErrorHandlingConfig();
    errorHandlingConfig.setNotifyErrorToBusinessApplication(true);
    
    DeliveryConfiguration deliverySpecification = new DeliveryConfiguration();
    deliverySpecification.setFactory(NullDeliveryMethod.class.getName());
    deliverySpecification.setId("delivery_spec_id");
    errorHandlingConfig.setErrorDelivery(deliverySpecification);
    umFlow.setErrorHandlingConfiguration(errorHandlingConfig);
    leg.setUserMessageFlow(umFlow);
   
    HolodeckB2BCore.getPModeSet().add(pmode);
    UserMessage userMessage = new UserMessage();
    userMessage.setMessageId(MessageIdUtils.createMessageId());
    userMessage.setPModeId(pmode.getId());
    
    MessageContext mc = new MessageContext();
    mc.setFLOW(MessageContext.IN_FLOW);
    mc.setServerSide(true);
    EbmsError ebmsError = new EbmsError();
    ebmsError.setSeverity(IEbmsError.Severity.failure);
    ebmsError.setErrorCode("some_error_code");
    ebmsError.setRefToMessageInError(userMessage.getMessageId());
    ebmsError.setMessage("some error message");
    ErrorMessage errorMessage = new ErrorMessage(ebmsError);
    errorMessage.setMessageId(T_MSG_ID);
    errorMessage.setPModeId(pmode.getId());
    errorMessage.setRefToMessageId(userMessage.getMessageId());
    
    StorageManager storageManager = HolodeckB2BCore.getStorageManager();
    IMessageUnitEntity umEntity = storageManager.storeOutGoingMessageUnit(userMessage);        
    
    IErrorMessageEntity errorMessageEntity = storageManager.storeIncomingMessageUnit(errorMessage);        
    storageManager.setProcessingState(errorMessageEntity, ProcessingState.READY_FOR_DELIVERY);
    
    IMessageProcessingContext procCtx = MessageProcessingContext.getFromMessageContext(mc);
    procCtx.addReceivedError(errorMessageEntity);        
    procCtx.addRefdMsgUnitByError(errorMessageEntity, Collections.singletonList(umEntity));
    
    try {
        assertEquals(Handler.InvocationResponse.CONTINUE, new DeliverErrors().invoke(mc));
    } catch (Exception e) {
        fail(e.getMessage());
    }
    assertTrue(((NullDeliverer) HolodeckB2BCore.getMessageDeliverer(deliverySpecification)).wasDelivered(T_MSG_ID));
    assertEquals(ProcessingState.DONE, errorMessageEntity.getCurrentProcessingState().getState());
}