@Test
  public void testHandleMessage() {
    StaticResponseEndpointAdapter endpointAdapter = new StaticResponseEndpointAdapter();
    Map<String, Object> header = new HashMap<String, Object>();
    header.put("Operation", "UnitTest");

    endpointAdapter.setMessageHeader(header);
    endpointAdapter.setMessagePayload("<TestMessage>Hello User!</TestMessage>");

    Message response =
        endpointAdapter.handleMessage(
            new DefaultMessage("<TestMessage>Hello World!</TestMessage>"));

    Assert.assertEquals(response.getPayload(), "<TestMessage>Hello User!</TestMessage>");
    Assert.assertNotNull(response.getHeader("Operation"));
    Assert.assertEquals(response.getHeader("Operation"), "UnitTest");
  }
  @Test
  public void testSendBuilderWithObjectMessageInstance() {
    final Message message = new DefaultMessage(new Integer(10)).setHeader("operation", "foo");
    MockTestDesigner builder =
        new MockTestDesigner(applicationContext) {
          @Override
          public void configure() {
            send(messageEndpoint).message(message);
          }
        };

    builder.configure();

    TestCase test = builder.getTestCase();
    Assert.assertEquals(test.getActionCount(), 1);
    Assert.assertEquals(test.getActions().get(0).getClass(), SendMessageAction.class);

    SendMessageAction action = ((SendMessageAction) test.getActions().get(0));
    Assert.assertEquals(action.getName(), "send");

    Assert.assertEquals(action.getEndpoint(), messageEndpoint);
    Assert.assertEquals(action.getMessageBuilder().getClass(), StaticMessageContentBuilder.class);

    StaticMessageContentBuilder messageBuilder =
        (StaticMessageContentBuilder) action.getMessageBuilder();
    Assert.assertEquals(messageBuilder.getMessage().getPayload(), 10);
    Assert.assertEquals(messageBuilder.getMessageHeaders().size(), 0L);
    Assert.assertEquals(
        messageBuilder.getMessage().copyHeaders().size(), message.copyHeaders().size());
    Assert.assertEquals(
        messageBuilder.getMessage().getHeader(MessageHeaders.ID),
        message.getHeader(MessageHeaders.ID));
    Assert.assertEquals(messageBuilder.getMessage().getHeader("operation"), "foo");

    Message constructed =
        messageBuilder.buildMessageContent(new TestContext(), MessageType.PLAINTEXT.name());
    Assert.assertEquals(constructed.copyHeaders().size(), message.copyHeaders().size());
    Assert.assertEquals(constructed.getHeader("operation"), "foo");
    Assert.assertEquals(
        constructed.getHeader(MessageHeaders.ID), message.getHeader(MessageHeaders.ID));
  }