I try to use WicketTester and custom session class. Of course it doesn’t work.:

Listing 1. WicketTester and Session, fail

INFO  - WebApplication             - [WicketTester$DummyWebApplication] Started Wicket version 1.3.6 in development mode
ERROR - RequestCycle               - Can't instantiate page using constructor public pl.koziolekweb.programmers.wicket.HomePage(org.apache.wicket.PageParameters) and argument 
org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor public pl.koziolekweb.programmers.wicket.HomePage(org.apache.wicket.PageParameters) and argument 
	at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:168)
	at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:66)
	at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:272)
	at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:293)
	at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:210)
	at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:91)
	at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1220)
	at org.apache.wicket.RequestCycle.step(RequestCycle.java:1297)
	at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1399)
	at org.apache.wicket.RequestCycle.request(RequestCycle.java:575)
	at org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:469)
	at org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:378)
	at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:289)
	at pl.koziolekweb.programmers.wicket.TestHomePage.testRenderMyPage(TestHomePage.java:35)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
	at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
	at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
	at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:147)
	... 41 more
Caused by: java.lang.ClassCastException: org.apache.wicket.protocol.http.WebSession cannot be cast to pl.koziolekweb.programmers.wicket.MySession
	at pl.koziolekweb.programmers.wicket.HomePage.<init>(HomePage.java:29)
	... 46 more
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.636 sec 
<p>WTF??? Ok, WicketTester can use custom session implementation only when is initialized using custom webapplication class:</p>
<p class="listing">Listing 2. <samp>WicketTester</samp> and custom application class</p>java

@Before
public void setUp() {
	tester = new WicketTester(new WicketApplication());
}</init>