01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.wicket.markup.html.basic;
18:
19: import junit.framework.TestCase;
20:
21: import org.apache.wicket.util.diff.DiffUtil;
22: import org.apache.wicket.util.tester.WicketTester;
23:
24: /**
25: * @author jcompagner
26: */
27: public class HomePageRedirectTest extends TestCase {
28: WicketTester application;
29:
30: protected void setUp() throws Exception {
31: application = new WicketTester();
32: }
33:
34: protected void tearDown() throws Exception {
35: application.destroy();
36: }
37:
38: /**
39: * Construct.
40: */
41: public HomePageRedirectTest() {
42: super ();
43: }
44:
45: /**
46: * @throws Exception
47: */
48: public void testRenderHomePagePageRedirect() throws Exception {
49: application.startPage(HomePagePageRedirect.class);
50:
51: assertEquals(RedirectPage.class, application
52: .getLastRenderedPage().getClass());
53:
54: // Validate the document
55: String document = application.getServletResponse()
56: .getDocument();
57: DiffUtil.validatePage(document, this .getClass(),
58: "RedirectPage.html", true);
59: }
60:
61: /**
62: * @throws Exception
63: */
64: public void testRenderHomePageClassRedirect() throws Exception {
65: application.startPage(HomePageClassRedirect.class);
66:
67: assertEquals(RedirectPage.class, application
68: .getLastRenderedPage().getClass());
69:
70: // Validate the document
71: String document = application.getServletResponse()
72: .getDocument();
73: DiffUtil.validatePage(document, this .getClass(),
74: "RedirectPage.html", true);
75: }
76: }
|