File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\test\src\test\java\lib\form\AdvancedButtonTest.java.html

1 package lib.form;
2
3 import com.gargoylesoftware.htmlunit.html.HtmlForm;
4 import com.gargoylesoftware.htmlunit.html.HtmlPage;
5 import hudson.util.FormValidation;
6 import net.sf.json.JSONObject;
7 import org.jvnet.hudson.test.HudsonTestCase;
8 import org.kohsuke.stapler.StaplerRequest;
9
10
11 /**
12 *
13 *
14 * @author Kohsuke Kawaguchi
15 */
16 public class AdvancedButtonTest extends HudsonTestCase {
17 public void testNestedOptionalBlock() throws Exception {
18 HtmlPage p = createWebClient().goTo("self/testNestedOptionalBlock");
19 HtmlForm f = p.getFormByName("config");
20 f.getButtonByCaption("Advanced...").click();
21 f.getInputByName("c").click();
22 submit(f);
23 }
24
25 public FormValidation doSubmitNestedOptionalBlock(StaplerRequest req) throws Exception {
26 JSONObject f = req.getSubmittedForm();
27 System.out.println(f);
28 assertEquals("avalue",f.getString("a"));
29 assertEquals("bvalue",f.getString("b"));
30 JSONObject c = f.getJSONObject("c");
31 assertEquals("dvalue",c.getString("d"));
32 return FormValidation.ok();
33 }
34 }