01: /**
02: *
03: */package wicket.markup.html.basic;
04:
05: import junit.framework.TestCase;
06: import wicket.markup.html.form.Form;
07: import wicket.protocol.http.MockHttpServletRequest;
08: import wicket.protocol.http.MockWebApplication;
09:
10: /**
11: * @author jcompagner
12: *
13: */
14: public class SimpleResponsePageClassTest extends TestCase {
15: /**
16: * @throws Exception
17: */
18: public void testResponsePageClass() throws Exception {
19: MockWebApplication mockWebApp = new MockWebApplication(null);
20:
21: mockWebApp.setHomePage(SimpleResponsePageClass.class);
22: mockWebApp.setupRequestAndResponse();
23: mockWebApp.processRequestCycle();
24: SimpleResponsePageClass manageBook = (SimpleResponsePageClass) mockWebApp
25: .getLastRenderedPage();
26:
27: Form form = (Form) manageBook.get("form");
28: mockWebApp.setupRequestAndResponse();
29:
30: MockHttpServletRequest mockRequest = mockWebApp
31: .getServletRequest();
32: mockRequest.setRequestToComponent(form);
33: mockWebApp.processRequestCycle();
34:
35: //assertion failed, getLastRenderedPage() return null.
36: assertTrue(mockWebApp.getLastRenderedPage() instanceof SimplePage);
37:
38: }
39: }
|