Search in sources :

Example 76 with WicketTester

use of org.apache.wicket.util.tester.WicketTester in project wicket by apache.

the class RequestCycleListenerDetachOrderTest method pageDetachedBeforeListener.

@Test
public void pageDetachedBeforeListener() {
    List<Event> events = new ArrayList<Event>();
    WicketTester tester = new WicketTester();
    tester.getApplication().getRequestCycleListeners().add(new TestListener(events));
    tester.startPage(new TestPage(events));
    assertEquals(Event.PAGE_DETACHED, events.get(0));
    assertEquals(Event.LISTENER_DETACHED, events.get(1));
}
Also used : ArrayList(java.util.ArrayList) WicketTester(org.apache.wicket.util.tester.WicketTester) Test(org.junit.Test)

Example 77 with WicketTester

use of org.apache.wicket.util.tester.WicketTester in project wicket by apache.

the class HttpsMapperApplicationTest method switchHttpsToHttpWithCustomPorts.

@Test
public void switchHttpsToHttpWithCustomPorts() {
    WicketTester tester = new WicketTester(new HttpsMapperApplication(123, 456));
    tester.getRequest().setScheme("https");
    tester.getRequest().setServerPort(443);
    requestPage(tester, HttpPage.class);
    assertEquals("http", tester.getLastRequest().getScheme());
    assertEquals(123, tester.getLastRequest().getServerPort());
}
Also used : WicketTester(org.apache.wicket.util.tester.WicketTester) Test(org.junit.Test)

Example 78 with WicketTester

use of org.apache.wicket.util.tester.WicketTester in project wicket by apache.

the class HttpsMapperApplicationTest method switchDefaultToHttpsWithDefaultPorts.

@Test
public void switchDefaultToHttpsWithDefaultPorts() {
    WicketTester tester = new WicketTester(new HttpsMapperApplication());
    requestPage(tester, HttpsPage.class);
    assertEquals("https", tester.getLastRequest().getScheme());
}
Also used : WicketTester(org.apache.wicket.util.tester.WicketTester) Test(org.junit.Test)

Example 79 with WicketTester

use of org.apache.wicket.util.tester.WicketTester in project wicket by apache.

the class HttpsMapperApplicationTest method switchDefaultToHttpsWithCustomPort.

@Test
public void switchDefaultToHttpsWithCustomPort() {
    WicketTester tester = new WicketTester(new HttpsMapperApplication(123, 456));
    requestPage(tester, HttpsPage.class);
    assertEquals("https", tester.getLastRequest().getScheme());
    assertEquals(456, tester.getLastRequest().getServerPort());
}
Also used : WicketTester(org.apache.wicket.util.tester.WicketTester) Test(org.junit.Test)

Example 80 with WicketTester

use of org.apache.wicket.util.tester.WicketTester in project wicket by apache.

the class HttpsMapperApplicationTest method testProtocolSwitchForNextRequest.

@Test
public void testProtocolSwitchForNextRequest() {
    WicketTester tester = new WicketTester(new HttpsMapperApplication());
    requestPage(tester, HttpsPage.class);
    assertEquals("https", tester.getLastRequest().getScheme());
    assertEquals("https", tester.getRequest().getScheme());
}
Also used : WicketTester(org.apache.wicket.util.tester.WicketTester) Test(org.junit.Test)

Aggregations

WicketTester (org.apache.wicket.util.tester.WicketTester)89 Test (org.junit.Test)54 Before (org.junit.Before)26 FormTester (org.apache.wicket.util.tester.FormTester)14 WebApplication (org.apache.wicket.protocol.http.WebApplication)9 MockApplication (org.apache.wicket.mock.MockApplication)6 AbstractDeploymentTest (org.apache.wicket.arquillian.testing.deployment.AbstractDeploymentTest)5 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)5 IPageManagerProvider (org.apache.wicket.IPageManagerProvider)4 IPageManagerContext (org.apache.wicket.page.IPageManagerContext)4 DummyApplication (org.apache.wicket.resource.DummyApplication)4 Component (org.apache.wicket.Component)3 Response (org.apache.wicket.request.Response)3 WicketApplication (sandbox.WicketApplication)3 TestWicketJavaEEApplication (org.apache.wicket.arquillian.testing.TestWicketJavaEEApplication)2 IAuthorizationStrategy (org.apache.wicket.authorization.IAuthorizationStrategy)2 RoleAuthorizationStrategy (org.apache.wicket.authroles.authorization.strategies.role.RoleAuthorizationStrategy)2 MockPageManager (org.apache.wicket.mock.MockPageManager)2 IManageablePage (org.apache.wicket.page.IManageablePage)2 IPageManager (org.apache.wicket.page.IPageManager)2