MapperResponseHandler implements ResponseHandler<T> { @Override public T handleResponse(HttpResponse response) throws IOException { StatusLine statusLine = response.getStatusLine(); return statusLine.getStatusCode() >= 300 ? error(response) : ok(response); } MapperResponseHandler(Class<T> type);  MapperResponseHandler(Class<T> type, ContentType override);  MapperResponseHandler(Class<T> type, ErrorHandler errorHandler);  MapperResponseHandler(String namespace, Class<T> type);  MapperResponseHandler(String namespace, Class<T> type, ContentType override);  MapperResponseHandler(String namespace, Class<T> type, ErrorHandler errorHandler);  MapperResponseHandler(String namespace, Class<T> type, ErrorHandler errorHandler, ContentType override); @Override T handleResponse(HttpResponse response);  }
@Test(expectedExceptions = GlazeException.class) public void handleError() throws IOException { HttpResponse response = Mockito.mock(HttpResponse.class); Mockito.when(response.getStatusLine()).thenReturn(new BasicStatusLine(HttpVersion.HTTP_1_1, 401, "Unauth")); MapperResponseHandler<Bar> mrh = new MapperResponseHandler<Bar>(Bar.class); mrh.handleResponse(response); }