001: /*
002: * $Id: WicketNamespaceTest.java 461190 2006-06-28 06:35:51Z ehillenius $
003: * $Revision: 461190 $
004: * $Date: 2006-06-28 08:35:51 +0200 (Wed, 28 Jun 2006) $
005: *
006: * ====================================================================
007: * Licensed under the Apache License, Version 2.0 (the "License");
008: * you may not use this file except in compliance with the License.
009: * You may obtain a copy of the License at
010: *
011: * http://www.apache.org/licenses/LICENSE-2.0
012: *
013: * Unless required by applicable law or agreed to in writing, software
014: * distributed under the License is distributed on an "AS IS" BASIS,
015: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016: * See the License for the specific language governing permissions and
017: * limitations under the License.
018: */
019: package wicket.markup;
020:
021: import junit.framework.TestCase;
022: import wicket.protocol.http.MockWebApplication;
023: import wicket.util.diff.DiffUtil;
024:
025: /**
026: */
027: public class WicketNamespaceTest extends TestCase {
028: // private static final Log log = LogFactory.getLog(WicketNamespaceTest.class);
029:
030: private MockWebApplication application;
031:
032: /**
033: * Create the test.
034: *
035: * @param name
036: * The test name
037: */
038: public WicketNamespaceTest(String name) {
039: super (name);
040: }
041:
042: /**
043: * @throws Exception
044: */
045: public void testRenderHomePage_1() throws Exception {
046: executeTest(WicketNamespace_1.class,
047: "WicketNamespaceExpectedResult_1.html");
048: }
049:
050: /**
051: * @throws Exception
052: */
053: public void testRenderHomePage_2() throws Exception {
054: executeTest(WicketNamespace_2.class,
055: "WicketNamespaceExpectedResult_2.html");
056: }
057:
058: /**
059: * @throws Exception
060: */
061: public void testRenderHomePage_3() throws Exception {
062: executeTest(WicketNamespace_3.class,
063: "WicketNamespaceExpectedResult_3.html");
064: }
065:
066: /**
067: * @throws Exception
068: */
069: public void testRenderHomePage_4() throws Exception {
070: executeTest(WicketNamespace_4.class,
071: "WicketNamespaceExpectedResult_4.html");
072: }
073:
074: /**
075: * @throws Exception
076: */
077: public void testRenderHomePage_5() throws Exception {
078: executeTest(WicketNamespace_5.class,
079: "WicketNamespaceExpectedResult_5.html");
080: }
081:
082: /**
083: * @throws Exception
084: */
085: public void testRenderHomePage_6() throws Exception {
086: executeTest(WicketNamespace_6.class,
087: "WicketNamespaceExpectedResult_6.html");
088: }
089:
090: /**
091: * @param pageClass
092: * @param filename
093: * @throws Exception
094: */
095: public void executeTest(final Class pageClass, final String filename)
096: throws Exception {
097: System.out.println("=== " + pageClass.getName() + " ===");
098:
099: application = new MockWebApplication(null);
100: application.setHomePage(pageClass);
101:
102: // Do the processing
103: application.setupRequestAndResponse();
104: application.processRequestCycle();
105:
106: // Validate the document
107: String document = application.getServletResponse()
108: .getDocument();
109: assertTrue(DiffUtil.validatePage(document, this.getClass(),
110: filename));
111: }
112: }
|