Buggy code:
public class IndexedParamUrlCodingTest extends WicketTestCase { public IndexedParamUrlCodingTest ( String name ) { } public void testIndexedLink ( ) throws Exception { tester . getApplication ( ) . mount ( "//test1" , new IndexedParamUrlCodingStrategy ( "//test1" , BookmarkableHomePageLinksPage . class , null ) ) ; tester . getApplication ( ) . mount ( "//test2" , new IndexedParamUrlCodingStrategy ( "//test2" , BookmarkableHomePageLinksPage . class , "mypagemap" ) ) ; tester . setupRequestAndResponse ( ) ; WebRequestCycle cycle = tester . createRequestCycle ( ) ; PageParameters parameters = new PageParameters ( ) ; parameters . add ( "0" , "Integer0" ) ; parameters . add ( "1" , "Integer1" ) ; parameters . add ( "2" , "a:b" ) ; String url1 = cycle . urlFor ( new BookmarkablePageRequestTarget ( BookmarkableHomePageLinksPage . class , parameters ) ) . toString ( ) ; String url2 = cycle . urlFor ( new BookmarkablePageRequestTarget ( "mypagemap" , BookmarkableHomePageLinksPage . class , parameters ) ) . toString ( ) ; assertEquals ( "test1//Integer0//Integer1//a%3Ab" , url1 ) ; <START_BUG> assertEquals ( "test2//Integer0//Integer1//a%3Ab//org.apache.wicket:pageMapName//mypagemap" , url2 ) ; <END_BUG> tester . setupRequestAndResponse ( ) ; tester . getServletRequest ( ) . setURL ( ( "//" + url1 ) ) ; cycle = tester . createRequestCycle ( ) ; IRequestCodingStrategy encoder = cycle . getProcessor ( ) . getRequestCodingStrategy ( ) ; RequestParameters requestParameters = encoder . decode ( tester . getWicketRequest ( ) ) ; IRequestTarget target1 = cycle . getProcessor ( ) . resolve ( cycle , requestParameters ) ; if ( target1 instanceof BookmarkablePageRequestTarget ) { assertNull ( ( ( BookmarkablePageRequestTarget ) ( target1 ) ) . getPageMapName ( ) ) ; } else { fail ( ( ( ( "url:<seq2seq4repair_space>" + url1 ) + "<seq2seq4repair_space>wasn't<seq2seq4repair_space>resolved<seq2seq4repair_space>to<seq2seq4repair_space>a<seq2seq4repair_space>bookmarkable<seq2seq4repair_space>target:<seq2seq4repair_space>" ) + target1 ) ) ; } PageParameters params = ( ( BookmarkablePageRequestTarget ) ( target1 ) ) . getPageParameters ( ) ; assertEquals ( "Integer0" , params . getString ( "0" ) ) ; assertEquals ( "Integer1" , params . getString ( "1" ) ) ; assertEquals ( "a:b" , params . getString ( "2" ) ) ; tester . setupRequestAndResponse ( ) ; tester . getServletRequest ( ) . setURL ( ( "//" + url2 ) ) ; cycle = tester . createRequestCycle ( ) ; encoder = cycle . getProcessor ( ) . getRequestCodingStrategy ( ) ; requestParameters = encoder . decode ( tester . getWicketRequest ( ) ) ; IRequestTarget target2 = cycle . getProcessor ( ) . resolve ( cycle , requestParameters ) ; if ( target2 instanceof BookmarkablePageRequestTarget ) { assertEquals ( "mypagemap" , ( ( BookmarkablePageRequestTarget ) ( target2 ) ) . getPageMapName ( ) ) ; } else { fail ( ( ( ( "url:<seq2seq4repair_space>" + url2 ) + "<seq2seq4repair_space>wasn't<seq2seq4repair_space>resolved<seq2seq4repair_space>to<seq2seq4repair_space>a<seq2seq4repair_space>bookmarkable<seq2seq4repair_space>target:<seq2seq4repair_space>" ) + target2 ) ) ; } } }

Fix:
assertEquals ( "test2//Integer0//Integer1//a%3Ab//wicket:pageMapName//mypagemap" , url2 ) ;