@Test public void testExecuteWithResponse() { final Object request = new Object(); final Object response = new Object(); context.checking(new Expectations() { { oneOf(domainMapper).execute(request); will(returnValue(response)); } }); PartialMapperResponse<Object, Object> partialResponse = new PartialMapperWrapper<Object, Object>(domainMapper) .execute(request); assertSame(response, partialResponse.getResponse()); assertNull(partialResponse.getUnhandledRequest()); assertFalse(partialResponse.hasUnhandledRequest()); context.assertIsSatisfied(); }
@Override public PartialMapperResponse<Request, Response> execute(final Request inRequest) { Response response = domainMapper.execute(inRequest); if (response == null) { return new PartialMapperResponse<Request, Response>(response, inRequest); } else { return new PartialMapperResponse<Request, Response>(response); } }
PartialMapperWrapper implements
        DomainMapper<Request, PartialMapperResponse<Request, Response>> { @Override public PartialMapperResponse<Request, Response> execute(final Request inRequest) { Response response = domainMapper.execute(inRequest); if (response == null) { return new PartialMapperResponse<Request, Response>(response, inRequest); } else { return new PartialMapperResponse<Request, Response>(response); } } }
PartialMapperWrapper implements
        DomainMapper<Request, PartialMapperResponse<Request, Response>> { @Override public PartialMapperResponse<Request, Response> execute(final Request inRequest) { Response response = domainMapper.execute(inRequest); if (response == null) { return new PartialMapperResponse<Request, Response>(response, inRequest); } else { return new PartialMapperResponse<Request, Response>(response); } } PartialMapperWrapper(final DomainMapper<Request, Response> inDomainMapper); }
PartialMapperWrapper implements
        DomainMapper<Request, PartialMapperResponse<Request, Response>> { @Override public PartialMapperResponse<Request, Response> execute(final Request inRequest) { Response response = domainMapper.execute(inRequest); if (response == null) { return new PartialMapperResponse<Request, Response>(response, inRequest); } else { return new PartialMapperResponse<Request, Response>(response); } } PartialMapperWrapper(final DomainMapper<Request, Response> inDomainMapper); @Override PartialMapperResponse<Request, Response> execute(final Request inRequest); }
PartialMapperWrapper implements
        DomainMapper<Request, PartialMapperResponse<Request, Response>> { @Override public PartialMapperResponse<Request, Response> execute(final Request inRequest) { Response response = domainMapper.execute(inRequest); if (response == null) { return new PartialMapperResponse<Request, Response>(response, inRequest); } else { return new PartialMapperResponse<Request, Response>(response); } } PartialMapperWrapper(final DomainMapper<Request, Response> inDomainMapper); @Override PartialMapperResponse<Request, Response> execute(final Request inRequest);  }