use of org.apache.wicket.arquillian.testing.TestWicketJavaEEApplication in project wicket by apache.
the class ArquillianContainerProvidedTest method testNewApplication.
/**
* Test with new application.
*/
@Test
public void testNewApplication() throws MalformedURLException {
setWicketTester(new WicketTester(new TestWicketJavaEEApplication()));
assertNotNull(getWicketTester().getApplication());
log.info("Using mock servletcontext.");
log.info("WebApplication MOCK after wicketTester Name: " + getWicketTester().getApplication().getName());
log.info("ServletContext MOCK after wicketTester Name: " + getWicketTester().getServletContext().getServletContextName());
log.info("Server info: " + getWicketTester().getServletContext().getServerInfo());
assertEquals("Wicket Mock Test Environment v1.0", getWicketTester().getServletContext().getServerInfo());
// USING MOCK.
try {
findResourcesServletContext();
fail("Should not be able to find '/pages/InsertContact.html' in the mocked servlet context");
} catch (IllegalStateException isx) {
assertEquals(RESOURCE_PAGES_INSERT_CONTACT_HTML_NOT_FOUND, isx.getMessage());
}
}
use of org.apache.wicket.arquillian.testing.TestWicketJavaEEApplication in project wicket by apache.
the class ArquillianContainerProvidedTest method testNewApplicationTryReuseServletContextFilter.
/**
* Creating another application and trying to reuse the ServletContext/Filter.
*/
@Test
public void testNewApplicationTryReuseServletContextFilter() {
try {
log.info("Trying to reuse container's ServletContext/Filter.");
setWicketTester(new WicketTester(new TestWicketJavaEEApplication(), false));
fail("Should not be able to reuse the servlet context");
} catch (IllegalStateException e) {
assertEquals("servletContext is not set yet. Any code in your Application object that uses the wicket filter instance should be put in the init() method instead of your constructor", e.getMessage());
}
assertNull(wicketTester);
}
Aggregations