KickJava   Java API By Example, From Geeks To Geeks.

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


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 import com.meterware.httpunit.WebResponse;
22 import com.meterware.httpunit.WebConversation;
23 import com.meterware.httpunit.WebForm;
24 import com.meterware.httpunit.SubmitButton;
25
26
27 /**
28  * @author <a HREF="mailto:oliver@rossmueller.com">Oliver Rossmueller</a>
29  */

30 public class Bug972165CactusTest extends ServletTestCase
31 {
32
33     public Bug972165CactusTest(String JavaDoc string)
34     {
35         super(string);
36     }
37
38
39     public void testBug972165() throws Exception JavaDoc
40     {
41         RequestDispatcher JavaDoc rd = config.getServletContext().getRequestDispatcher("/Bug972165CactusTest.jsf");
42         // render the page for the first time
43
rd.forward(request, response);
44     }
45
46
47     public void endBug972165(WebResponse response)
48         throws Exception JavaDoc
49     {
50         WebConversation conversation = new WebConversation();
51         response = conversation.getResponse(response.getURL().toExternalForm());
52         WebForm form = response.getFormWithID("testForm");
53         SubmitButton submitButton = form.getSubmitButtonWithID("testForm:submit");
54
55         assertTrue(response.getText().indexOf("CheckDisabled:true") != -1);
56         assertEquals("true", form.getParameterValue("testForm:checkDisabled"));
57         response = form.submit(submitButton);
58         assertTrue(response.getText().indexOf("CheckDisabled:true") != -1);
59         assertEquals("true", form.getParameterValue("testForm:checkDisabled"));
60     }
61 }
62
Popular Tags