Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge pull request #968 from akiellor/JENKINS-18434
- Loading branch information
Showing
4 changed files
with
52 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
core/src/test/java/hudson/model/ChoiceParameterDefinitionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package hudson.model; | ||
|
||
import hudson.util.FormValidation; | ||
import jenkins.model.Jenkins; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
public class ChoiceParameterDefinitionTest { | ||
@Test | ||
public void shouldValidateChoices(){ | ||
assertFalse(ChoiceParameterDefinition.areValidChoices("")); | ||
assertFalse(ChoiceParameterDefinition.areValidChoices(" ")); | ||
assertTrue(ChoiceParameterDefinition.areValidChoices("abc")); | ||
assertTrue(ChoiceParameterDefinition.areValidChoices("abc\ndef")); | ||
assertTrue(ChoiceParameterDefinition.areValidChoices("abc\r\ndef")); | ||
} | ||
|
||
@Test | ||
public void testCheckChoices() throws Exception { | ||
ChoiceParameterDefinition.DescriptorImpl descriptorImpl = new ChoiceParameterDefinition.DescriptorImpl(); | ||
|
||
assertEquals(FormValidation.Kind.OK, descriptorImpl.doCheckChoices("abc\ndef").kind); | ||
assertEquals(FormValidation.Kind.ERROR, descriptorImpl.doCheckChoices("").kind); | ||
} | ||
} |