CatnapWrappingView implements View, WrappingView<CatnapView> { public com.github.gregwhitaker.catnap.core.context.HttpStatus httpStatus(HttpServletRequest request) { Object attr = request.getAttribute(RESPONSE_STATUS_ATTRIBUTE); if (attr != null) { int value = ((HttpStatus) attr).value(); return com.github.gregwhitaker.catnap.core.context.HttpStatus.valueOf(value); } return com.github.gregwhitaker.catnap.core.context.HttpStatus.OK; } CatnapWrappingView(final CatnapView view);  CatnapWrappingView(final CatnapView view, final String modelName); @Override void render(Map<String, ?> model, HttpServletRequest request, HttpServletResponse response); void setContentTypeHeader(HttpServletResponse response); com.github.gregwhitaker.catnap.core.context.HttpStatus httpStatus(HttpServletRequest request); Object extractResult(Map<String, ?> model); @Override String getContentType(); @Override String getCharacterEncoding(); @Override CatnapView getWrappedView(); @Override String getModelName(); static final String DEFAULT_MODELNAME; }
@Test public void httpStatusReturnsRequestStatus() { MockHttpServletRequest request = new MockHttpServletRequest(); request.setAttribute(View.RESPONSE_STATUS_ATTRIBUTE, org.springframework.http.HttpStatus.ACCEPTED); assertEquals(HttpStatus.ACCEPTED, new CatnapWrappingView(new JsonView()).httpStatus(request)); }
@Test public void httpStatusReturns200ByDefault() { assertEquals(HttpStatus.OK, new CatnapWrappingView(new JsonView()).httpStatus(new MockHttpServletRequest())); }