Skip to content
Permalink
Browse files
[JENKINS-11543] Unit test
(cherry picked from commit 75f5d21)
  • Loading branch information
olivergondza committed Oct 13, 2014
1 parent 21fb398 commit 66dce647d1d7df919f9707b4ce631cd49dc242f7
Showing with 26 additions and 0 deletions.
  1. +26 −0 test/src/test/java/hudson/model/ParametersTest.java
@@ -1,13 +1,20 @@
package hudson.model;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;

import org.junit.Test;
import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.CaptureEnvironmentBuilder;

import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
import com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput;
import com.gargoylesoftware.htmlunit.html.HtmlOption;

import java.util.Set;

/**
@@ -157,4 +164,23 @@ public void testMixedSensitivity() throws Exception {
assertTrue(sensitiveVars.contains("password"));
assertFalse(sensitiveVars.contains("string2"));
}

@Bug(11543)
public void testUnicodeParametersArePresetedCorrectly() throws Exception {
final FreeStyleProject p = createFreeStyleProject();
ParametersDefinitionProperty pdb = new ParametersDefinitionProperty(
new StringParameterDefinition("sname:a¶‱ﻷ", "svalue:a¶‱ﻷ", "sdesc:a¶‱ﻷ"),
new FileParameterDefinition("fname:a¶‱ﻷ", "fdesc:a¶‱ﻷ")
);
p.addProperty(pdb);

WebClient wc = createWebClient();
wc.setThrowExceptionOnFailingStatusCode(false); // Ignore 405
HtmlPage page = wc.getPage(p, "build");

// java.lang.IllegalArgumentException: No such parameter definition: <gibberish>.
wc.setThrowExceptionOnFailingStatusCode(true);
final HtmlForm form = page.getFormByName("parameters");
form.submit(form.getButtonByCaption("Build"));
}
}

0 comments on commit 66dce64

Please sign in to comment.