### Question:
MvcViewHandler extends ViewHandlerWrapper { @Override public String getBookmarkableURL(FacesContext context, String viewId, Map<String, List<String>> parameters, boolean includeViewParams) { String url = getBookmarkUrlIfResolvable(context, viewId, parameters); if (url == null) { url = super.getBookmarkableURL(context, viewId, parameters, includeViewParams); } return url; } MvcViewHandler(ViewHandler delegate, DestinationViewResolver destinationViewResolver); @Override ViewHandler getWrapped(); @Override UIViewRoot createView(FacesContext context, String viewId); @Override UIViewRoot restoreView(FacesContext context, String viewId); @Override String getActionURL(FacesContext context, String viewId); @Override ViewDeclarationLanguage getViewDeclarationLanguage(FacesContext context, String viewId); @Override void renderView(FacesContext context, UIViewRoot viewToRender); @Override String getBookmarkableURL(FacesContext context, String viewId, Map<String, List<String>> parameters,
			boolean includeViewParams); @Override String getRedirectURL(FacesContext context, String viewId, Map<String, List<String>> parameters,
			boolean includeViewParams);  }### Answer:
@Test public void shouldDelegateGetBookmarkableUrl() throws Exception { Map<String, List<String>> parameters = new HashMap<String, List<String>>(); boolean includeViewParams = false; this.handler.getBookmarkableURL(this.context, this.viewId, parameters, includeViewParams); verify(this.delegate).getBookmarkableURL(this.context, this.viewId, parameters, includeViewParams); }
@Test public void shouldGetResolvableBookmark() throws Exception { SpringFacesContextSetter.setCurrentInstance(this.springFacesContext); DestinationAndModel destinationAndModel = mock(DestinationAndModel.class); BookmarkableView destination = mock(BookmarkableView.class); given(destinationAndModel.getDestination()).willReturn(destination); given(destination.getBookmarkUrl(anyModel(), any(HttpServletRequest.class))).willReturn("/bookmark"); given(this.destinationAndModelRegistry.get(this.context, this.viewId)).willReturn(destinationAndModel); Map<String, List<String>> parameters = new HashMap<String, List<String>>(); boolean includeViewParams = false; String bookmark = this.handler.getBookmarkableURL(this.context, this.viewId, parameters, includeViewParams); assertThat(bookmark, is(equalTo("/bookmark"))); }
@Test public void shouldRequireBookmarkInterfaceIfResolved() throws Exception { SpringFacesContextSetter.setCurrentInstance(this.springFacesContext); DestinationAndModel destinationAndModel = mock(DestinationAndModel.class); View destination = mock(View.class); given(destinationAndModel.getDestination()).willReturn(destination); given(this.destinationAndModelRegistry.get(this.context, this.viewId)).willReturn(destinationAndModel); Map<String, List<String>> parameters = new HashMap<String, List<String>>(); boolean includeViewParams = false; this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("must be an instance of interface " + BookmarkableView.class.getName()); this.handler.getBookmarkableURL(this.context, this.viewId, parameters, includeViewParams); }