private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType,
String content, Class<? extends Exception> expected, String exceptionMessage) {
T function = Guice.createInjector().getInstance(getClassToTest());
HttpCommand command = createMock(HttpCommand.class);
HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build();
HttpResponse response = HttpResponse.builder()
.statusCode(statusCode)
.message(message)
.payload(content).build();
response.getPayload().getContentMetadata().setContentType(contentType);
expect(command.getCurrentRequest()).andReturn(request).atLeastOnce();
command.setException(exceptionEq(expected, exceptionMessage));
replay(command);
function.handleError(command, response);