DefaultMessageContext extends AbstractMessageContext { @Override public WebServiceMessage getResponse() { if (response == null) { response = messageFactory.createWebServiceMessage(); } return response; } DefaultMessageContext(WebServiceMessageFactory messageFactory);  DefaultMessageContext(WebServiceMessage request, WebServiceMessageFactory messageFactory); @Override WebServiceMessage getRequest(); @Override boolean hasResponse(); @Override WebServiceMessage getResponse(); @Override void setResponse(WebServiceMessage response); @Override void clearResponse(); @Override void readResponse(InputStream inputStream); WebServiceMessageFactory getMessageFactory();  }
@Test public void testResponse() throws Exception { WebServiceMessage response = new MockWebServiceMessage(); expect(factoryMock.createWebServiceMessage()).andReturn(response); replay(factoryMock); WebServiceMessage result = context.getResponse(); Assert.assertEquals("Invalid response returned", response, result); verify(factoryMock); }