### Question:
DefaultURLConstructor implements URLConstructor { private String makeURL( final String context, final String name ) { return doReplacement( getURLPattern( context, name ), name ); }  @Override void initialize( final Engine engine, final Properties properties ); static String getURLPattern( final String context, final String name ); @Override String makeURL( final String context, final String name, String parameters ); @Override String parsePage( final String context, final HttpServletRequest request, final Charset encoding ); @Override String getForwardPage( final HttpServletRequest request );  }### Answer:
@Test public void testViewURL1() throws Exception { final URLConstructor c = getConstructor("wiki/" ); Assertions.assertEquals( "/test/Wiki.jsp?page=Main", c.makeURL( ContextEnum.PAGE_VIEW.getRequestContext(),"Main",null) ); }
@Test public void testViewURL2() throws Exception { final URLConstructor c = getConstructor( null ); Assertions.assertEquals( "/test/Wiki.jsp?page=Main", c.makeURL(ContextEnum.PAGE_VIEW.getRequestContext(),"Main",null) ); }
@Test public void testViewURL3() throws Exception { final URLConstructor c = getConstructor( null ); Assertions.assertEquals( "/test/Wiki.jsp?page=Main", c.makeURL(ContextEnum.PAGE_VIEW.getRequestContext(),"Main",null) ); }
@Test public void testViewURL4() throws Exception { final URLConstructor c = getConstructor( null ); Assertions.assertEquals( "/test/Wiki.jsp?page=Main", c.makeURL(ContextEnum.PAGE_VIEW.getRequestContext(),"Main",null) ); }
@Test public void testViewURL5() throws Exception { final URLConstructor c = getConstructor( "" ); Assertions.assertEquals( "/test/Wiki.jsp?page=Main", c.makeURL(ContextEnum.PAGE_VIEW.getRequestContext(),"Main",null) ); }
@Test public void testViewURL6() throws Exception { final URLConstructor c = getConstructor( null ); Assertions.assertEquals( "/test/Wiki.jsp?page=Main", c.makeURL(ContextEnum.PAGE_VIEW.getRequestContext(),"Main",null) ); }
@Test public void testViewURL7() throws Exception { final URLConstructor c = getConstructor( "view/" ); Assertions.assertEquals( "/test/Wiki.jsp?page=Main", c.makeURL(ContextEnum.PAGE_VIEW.getRequestContext(),"Main",null) ); }
@Test public void testEditURL1() throws Exception { final URLConstructor c = getConstructor( null ); Assertions.assertEquals( "/test/Edit.jsp?page=Main", c.makeURL(ContextEnum.PAGE_EDIT.getRequestContext(),"Main",null) ); }
@Test public void testAttachURL1() throws Exception { final URLConstructor c = getConstructor( null ); Assertions.assertEquals( "/test/attach/Main/foo.txt", c.makeURL(ContextEnum.PAGE_ATTACH.getRequestContext(),"Main/foo.txt",null) ); }
@Test public void testAttachURLRelative1() throws Exception { final URLConstructor c = getConstructor( null ); Assertions.assertEquals( "/test/attach/Main/foo.txt", c.makeURL(ContextEnum.PAGE_ATTACH.getRequestContext(),"Main/foo.txt",null) ); }
@Test public void testOtherURL1() throws Exception { final URLConstructor c = getConstructor( null ); Assertions.assertEquals( "/test/foo.jsp", c.makeURL(ContextEnum.PAGE_NONE.getRequestContext(),"foo.jsp",null) ); }
@Test public void testOtherURL2() throws Exception { final URLConstructor c = getConstructor( null ); Assertions.assertEquals( "/test/foo.jsp?a=1&amp;b=2", c.makeURL(ContextEnum.PAGE_NONE.getRequestContext(),"foo.jsp","a=1&amp;b=2") ); }
@Test public void testEmptyURL() throws Exception { final URLConstructor c = getConstructor( null ); Assertions.assertEquals( "/test/Wiki.jsp?page=", c.makeURL(ContextEnum.PAGE_VIEW.getRequestContext(),"",null) ); }