KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > renderkit > html > HtmlInputHiddenCactusTest


1 /*
2  * Copyright 2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.myfaces.renderkit.html;
17
18 import javax.servlet.RequestDispatcher JavaDoc;
19
20 import org.apache.cactus.ServletTestCase;
21
22 import com.meterware.httpunit.SubmitButton;
23 import com.meterware.httpunit.WebConversation;
24 import com.meterware.httpunit.WebForm;
25 import com.meterware.httpunit.WebResponse;
26
27 /**
28  * @author Manfred Geiler (latest modification by $Author: matze $)
29  * @version $Revision: 1.3 $ $Date: 2004/10/13 11:50:56 $
30  * $Log: HtmlInputHiddenCactusTest.java,v $
31  * Revision 1.3 2004/10/13 11:50:56 matze
32  * renamed packages to org.apache
33  *
34  * Revision 1.2 2004/07/01 21:57:56 mwessendorf
35  * ASF switch
36  *
37  * Revision 1.1 2004/05/26 17:19:57 o_rossmueller
38  * test for bug 948626
39  *
40  * Revision 1.1 2004/05/04 06:36:20 manolito
41  * Bugfix #947302
42  *
43  */

44 public class HtmlInputHiddenCactusTest
45         extends ServletTestCase
46 {
47     //private static final Log log = LogFactory.getLog(HtmlInputHiddenTagCactusTest.class);
48

49     public HtmlInputHiddenCactusTest(String JavaDoc name) {
50         super(name);
51     }
52
53     public void testBug948626() throws Exception JavaDoc
54     {
55         RequestDispatcher JavaDoc rd = config.getServletContext().getRequestDispatcher(
56                 "/HtmlInputHiddenTagCactusTest.jsf");
57         // render the page for the first time
58
rd.forward(request, response);
59     }
60
61     public void endBug948626(WebResponse response)
62             throws Exception JavaDoc
63     {
64         WebConversation conversation = new WebConversation();
65         response = conversation.getResponse(response.getURL().toExternalForm());
66         WebForm form = response.getFormWithID("testForm");
67         SubmitButton submitButton = form.getSubmitButtonWithID("testForm:submit");
68         assertEquals("0", form.getParameterValue("testForm:hidden"));
69         assertTrue(response.getText().indexOf("false") != -1);
70         assertTrue(response.getText().indexOf("true") == -1);
71         response = form.submit(submitButton);
72         assertTrue(response.getText().indexOf("false") == -1);
73         assertTrue(response.getText().indexOf("true") != -1);
74     }
75 }
76
Popular Tags