{
Command a;
WikiPage page = m_engine.getPage( "SinglePage" );
// Passing an EDIT request with page param yields a wrapped action
MockHttpServletRequest request = m_engine.newHttpRequest( "/Edit.jsp?page=SinglePage" );
request.getParameterMap().put( "page", new String[]{ "SinglePage" } );
a = resolver.findCommand( request, WikiContext.EDIT );
assertNotSame( PageCommand.EDIT, a );
assertEquals( "EditContent.jsp", a.getContentTemplate() );
assertEquals( "Edit.jsp", a.getJSP() );
assertEquals( "%uEdit.jsp?page=%n", a.getURLPattern() );
assertEquals( page, a.getTarget() );
// Passing an EDIT request with page=Search yields FIND action, *not* edit
request.setContextPath( "/Edit.jsp?page=Search" );
request.getParameterMap().put( "page", new String[]{ "Search" } );
a = resolver.findCommand( request, WikiContext.EDIT );
assertEquals( WikiCommand.FIND, a );
assertEquals( "FindContent.jsp", a.getContentTemplate() );
assertEquals( "Search.jsp", a.getJSP() );
assertEquals( "%uSearch.jsp", a.getURLPattern() );
assertNull( a.getTarget() );
// Passing an EDIT request with group="Foo" yields wrapped VIEW_GROUP
request = m_engine.newHttpRequest( "/Group.jsp?group=Foo" );
request.getParameterMap().put( "group", new String[]{ "Foo" } );
a = resolver.findCommand( request, WikiContext.EDIT );
assertNotSame( GroupCommand.VIEW_GROUP, a );
assertEquals( "GroupContent.jsp", a.getContentTemplate() );
assertEquals( "Group.jsp", a.getJSP() );
assertEquals( "%uGroup.jsp?group=%n", a.getURLPattern() );