Search in sources :

Example 21 with WicketTester

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

the class AnnotationsRoleTest method testAuthorized.

/**
 * @throws Exception
 */
@Test
public void testAuthorized() throws Exception {
    WicketTester tester = new WicketTester();
    tester.getApplication().getSecuritySettings().setAuthorizationStrategy(new RoleAuthorizationStrategy(new UserRolesAuthorizer("ADMIN")));
    tester.startPage(AdminPage.class);
    tester.assertRenderedPage(AdminPage.class);
}
Also used : RoleAuthorizationStrategy(org.apache.wicket.authroles.authorization.strategies.role.RoleAuthorizationStrategy) WicketTester(org.apache.wicket.util.tester.WicketTester) Test(org.junit.Test)

Example 22 with WicketTester

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

the class ArquillianContainerProvidedTest method testNullApplication.

/**
 * Null application to test error.
 */
@Test
public void testNullApplication() {
    try {
        log.info("Trying to use a null application.");
        setWicketTester(new WicketTester(null, false));
        fail("WebApplication cannot be null");
    } catch (IllegalArgumentException iax) {
        assertEquals("Argument 'application' may not be null.", iax.getMessage());
    }
    assertNull(wicketTester);
}
Also used : WicketTester(org.apache.wicket.util.tester.WicketTester) AbstractDeploymentTest(org.apache.wicket.arquillian.testing.deployment.AbstractDeploymentTest) Test(org.junit.Test)

Example 23 with WicketTester

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

the class ArquillianContainerProvidedTest method testFindResourcesServletContextFromContainer.

/**
 * Using container's servlet context and/or filter provided configured in web.xml and using Arquillian.
 */
@Test
public void testFindResourcesServletContextFromContainer() throws MalformedURLException {
    WebApplication webApplication = useServletContextContainer();
    setWicketTester(new WicketTester(webApplication, webApplication.getServletContext(), false));
    findResourcesServletContext();
}
Also used : WicketTester(org.apache.wicket.util.tester.WicketTester) WebApplication(org.apache.wicket.protocol.http.WebApplication) AbstractDeploymentTest(org.apache.wicket.arquillian.testing.deployment.AbstractDeploymentTest) Test(org.junit.Test)

Example 24 with WicketTester

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

the class ArquillianContainerProvidedTest method testFindResourcesWebApplicationFromContainer.

/**
 * Using container's servlet context and/or filter provided configured in web.xml and using Arquillian.
 */
@Test
public void testFindResourcesWebApplicationFromContainer() throws MalformedURLException {
    WebApplication webApplication = useServletContextContainer();
    setWicketTester(new WicketTester(webApplication, false));
    findResourcesServletContext();
}
Also used : WicketTester(org.apache.wicket.util.tester.WicketTester) WebApplication(org.apache.wicket.protocol.http.WebApplication) AbstractDeploymentTest(org.apache.wicket.arquillian.testing.deployment.AbstractDeploymentTest) Test(org.junit.Test)

Example 25 with WicketTester

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

the class LocalizerTest method setUp.

/**
 * @throws Exception
 */
@Before
public void setUp() throws Exception {
    tester = new WicketTester(new DummyApplication());
    settings = tester.getApplication().getResourceSettings();
    localizer = tester.getApplication().getResourceSettings().getLocalizer();
}
Also used : WicketTester(org.apache.wicket.util.tester.WicketTester) DummyApplication(org.apache.wicket.resource.DummyApplication) Before(org.junit.Before)

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