### Question:
EbmsMessageHandler implements MessageHandler { public void onMessage(Message message) { log().debug("got message:" + message.getSource().toString()); try { EbmsRequest ebmsRequest = buildEbmsRequest(message); getMSH().processOutboundMessage(ebmsRequest, null); } catch (Exception e) { log().error("Failed to process outbound message: " + e); log().debug("",e); throw new RuntimeException(e); } }  void onMessage(Message message);  }### Answer:
@Test public void testEbmsMessageHandlerValidMessage() throws Exception { Message msg = buildMessage("TestMessage"); doAnswer(new Answer<Object>() { public Object answer(InvocationOnMock invocation) throws Throwable { Object arg = invocation.getArguments()[0]; assertThat(arg, instanceOf(EbmsRequest.class)); EbmsRequest request = (EbmsRequest) invocation.getArguments()[0]; assertThat(request, notNullValue()); EbxmlMessage ebxml = request.getMessage(); assertThat(ebxml, notNullValue()); assertThat(ebxml.getCpaId(),equalTo("cpaId")); assertThat(ebxml.getService(),equalTo("http: assertThat(ebxml.getAction(),equalTo("action")); assertThat(ebxml.getConversationId(),equalTo("conversationId")); assertThat(first(ebxml.getFromPartyIds()),equalTo("test_a")); assertThat(first(ebxml.getToPartyIds()),equalTo("test_b")); assertThat(ebxml.getTimeToLive(),notNullValue()); assertThat(ebxml.getMessageId(), equalTo("TEST-123456789")); assertThat(ebxml.getPayloadCount(),equalTo(1)); assertThat(ebxml.getPayloadContainer("Payload-0").getContentType(),equalTo("text/xml; charset=UTF-8")); return null; } }).when(msh).processOutboundMessage((EbmsRequest) any(), (EbmsResponse) isNull()); mh.onMessage(msg); verify(msh).processOutboundMessage((EbmsRequest) any(), (EbmsResponse) isNull()); }