### Question:
ViewIdSupport { public String deriveViewId(FacesContext context, String viewId) { return deriveViewId(context, viewId, true); } protected  ViewIdSupport(FacesContext facesContext); static ViewIdSupport getInstance(FacesContext facesContext); String deriveLogicalViewId(FacesContext context, String rawViewId); String deriveViewId(FacesContext context, String viewId); String calculateActionURL(FacesContext context, String viewId); boolean isViewExistent(FacesContext facesContext, String viewId); String calculateViewId(FacesContext facesContext); boolean isViewProtected(FacesContext context, String viewId);  }### Answer:
@Test public void testDeriveViewId1() throws Exception { request.setPathElements("/testwebapp", "/view1.jsf", null , null); String derivedViewId = viewHandlerSupport.deriveViewId(facesContext, "/view1.jsf"); Assert.assertNotNull(derivedViewId); }
@Test public void testDeriveViewId2() throws Exception { request.setPathElements("/testwebapp", "/faces", "/view1.jsp" , null); String derivedViewId = viewHandlerSupport.deriveViewId(facesContext, "/view1.jsp"); Assert.assertNotNull(derivedViewId); }
@Test public void testDeriveViewId21() throws Exception { request.setPathElements("/testwebapp", "/faces", "/faces/view1.jsp" , null); String derivedViewId = viewHandlerSupport.deriveViewId(facesContext, "/faces/view1.jsp"); Assert.assertNotNull(derivedViewId); }
@Test public void testDeriveViewId3() throws Exception { request.setPathElements("/testwebapp", "/view2.jsf", null , null); String derivedViewId = viewHandlerSupport.deriveViewId(facesContext, "/view2.jsf"); Assert.assertNotNull(derivedViewId); }
@Test public void testDeriveViewId4() throws Exception { request.setPathElements("/testwebapp", "/faces", "/view2.xhtml" , null); String derivedViewId = viewHandlerSupport.deriveViewId(facesContext, "/view2.xhtml"); Assert.assertNotNull(derivedViewId); }
@Test public void testDeriveViewId5() throws Exception { request.setPathElements("/testwebapp", "/noview1.jsf", null , null); String derivedViewId = viewHandlerSupport.deriveViewId(facesContext, "/noview1.jsf"); Assert.assertNull(derivedViewId); }
@Test public void testEmptyPrefixMapping() throws Exception { request.setPathElements("/testwebapp", "", "/view2.xhtml" , null); String derivedViewId = viewHandlerSupport.deriveViewId(facesContext, "/view2.xhtml"); Assert.assertEquals("/view2.xhtml", derivedViewId); }
@Test public void testEmptyPrefixMappingDoubleSlash() throws Exception { request.setPathElements("/testwebapp", "", " String derivedViewId = viewHandlerSupport.deriveViewId(facesContext, " Assert.assertEquals("/view2.xhtml", derivedViewId); }