Skip to content

Commit

Permalink
JUnit 4.
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick committed Jan 5, 2015
1 parent 449fd23 commit 4470b9e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions test/src/test/java/lib/form/NameRefTest.java
Expand Up @@ -25,27 +25,36 @@

import com.gargoylesoftware.htmlunit.html.HtmlPage;
import net.sf.json.JSONObject;
import org.jvnet.hudson.test.HudsonTestCase;
import static org.junit.Assert.*;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.HttpResponses;
import org.kohsuke.stapler.StaplerRequest;

/**
* Tests the handling of @nameRef in the form tree.
*
* @author Kohsuke Kawaguchi
*/
public class NameRefTest extends HudsonTestCase {
public void test1() throws Exception {
jenkins.setCrumbIssuer(null);
HtmlPage p = createWebClient().goTo("self/test1");
submit(p.getFormByName("config"));
public class NameRefTest {

@Rule public JenkinsRule r = new JenkinsRuleWithJelly();

@Test public void test() throws Exception {
r.jenkins.setCrumbIssuer(null);
HtmlPage p = r.createWebClient().goTo("self/test1");
r.submit(p.getFormByName("config"));
}

public HttpResponse doSubmitTest1(StaplerRequest req) throws Exception {
JSONObject f = req.getSubmittedForm();
System.out.println(f);
assertEquals("{\"foo\":{\"bar\":{\"zot\":\"zot\"}}}",f.toString());
return HttpResponses.ok();
public static class JenkinsRuleWithJelly extends JenkinsRule {

public HttpResponse doSubmitTest1(StaplerRequest req) throws Exception {
JSONObject f = req.getSubmittedForm();
System.out.println(f);
assertEquals("{\"foo\":{\"bar\":{\"zot\":\"zot\"}}}",f.toString());
return HttpResponses.ok();
}

}

}

0 comments on commit 4470b9e

Please sign in to comment.