@Test
public void testDoProcessing() throws Exception {

    MessageContext mc = new MessageContext();
    mc.setFLOW(MessageContext.IN_FLOW);
    UserMessage userMessage = new UserMessage();        
    Payload payload = new Payload();
    payload.setContainment(Containment.ATTACHMENT);
    payload.setMimeType("image/jpeg");
    payload.setPayloadURI("some-att-cid");
    userMessage.addPayload(payload);
    
    IMessageProcessingContext procCtx = MessageProcessingContext.getFromMessageContext(mc);
    IUserMessageEntity userMsgEntity = HolodeckB2BCore.getStorageManager().storeIncomingMessageUnit(userMessage);
    procCtx.setUserMessage(userMsgEntity);
    
    // Adding data handler for the payload described in mmd
    Attachments attachments = new Attachments();
    DataHandler dh = new DataHandler(new FileDataSource(baseDir + "/dandelion.jpg"));
    attachments.addDataHandler(payload.getPayloadURI(), dh);
    mc.setAttachmentMap(attachments);
    try {
        assertEquals(Handler.InvocationResponse.CONTINUE, new SaveUserMsgAttachments().invoke(mc));
    } catch (Exception e) {
        fail(e.getMessage());
    }
    String storedPayload = userMsgEntity.getPayloads().iterator().next().getContentLocation();
    assertFalse(Utils.isNullOrEmpty(storedPayload));        
    assertTrue(new File(storedPayload).exists());        
}