DefaultResult extends AbstractResult { public <T extends View> T use(Class<T> view) { responseCommitted = true; return container.instanceFor(view); } DefaultResult(); @Inject  DefaultResult(HttpServletRequest request, Container container, ExceptionMapper exceptions, TypeNameExtractor extractor); T use(Class<T> view); Result on(Class<? extends Exception> exception); Result include(String key, Object value); boolean used(); Map<String, Object> included(); Result include(Object value);  }
@Test public void shouldUseContainerForNewView() { final MyView expectedView = new MyView(); when(container.instanceFor(MyView.class)).thenReturn(expectedView); MyView view = result.use(MyView.class); assertThat(view, is(expectedView)); }