Skip to content
Permalink
Browse files

[JENKINS-27505] Added a test for two initial newlines.

  • Loading branch information...
ikedam committed Mar 30, 2015
1 parent 9794f02 commit 236632ba7170b073bc269bc64a3633da981dce24
Showing with 17 additions and 6 deletions.
  1. +17 −6 test/src/test/groovy/lib/form/TextAreaTest.groovy
@@ -77,21 +77,32 @@ class TextAreaTest {
public void testText() {
def TEXT_TO_TEST = "some\nvalue\n";
def p = j.createFreeStyleProject();
p.buildersList.add(new TextareaTestBuilder(TEXT_TO_TEST));
assertEquals(TEXT_TO_TEST, p.getBuildersList().get(TextareaTestBuilder.class).getText());
def target = new TextareaTestBuilder(TEXT_TO_TEST);
p.buildersList.add(target);
j.configRoundtrip(p);
assertEquals(TEXT_TO_TEST, p.getBuildersList().get(TextareaTestBuilder.class).getText());
j.assertEqualDataBoundBeans(target, p.getBuildersList().get(TextareaTestBuilder.class));
}

@Issue("JENKINS-27505")
@Test
public void testTextBeginningWithEmptyLine() {
def TEXT_TO_TEST = "\nbegin\n\nwith\nempty\nline\n\n";
def p = j.createFreeStyleProject();
p.buildersList.add(new TextareaTestBuilder(TEXT_TO_TEST));
assertEquals(TEXT_TO_TEST, p.getBuildersList().get(TextareaTestBuilder.class).getText());
def target = new TextareaTestBuilder(TEXT_TO_TEST);
p.buildersList.add(target);
j.configRoundtrip(p);
assertEquals(TEXT_TO_TEST, p.getBuildersList().get(TextareaTestBuilder.class).getText());
j.assertEqualDataBoundBeans(target, p.getBuildersList().get(TextareaTestBuilder.class));
}

@Issue("JENKINS-27505")
@Test
public void testTextBeginningWithTwoEmptyLines() {
def TEXT_TO_TEST = "\n\nbegin\n\nwith\ntwo\nempty\nline\n\n";
def p = j.createFreeStyleProject();
def target = new TextareaTestBuilder(TEXT_TO_TEST);
p.buildersList.add(target);
j.configRoundtrip(p);
j.assertEqualDataBoundBeans(target, p.getBuildersList().get(TextareaTestBuilder.class));
}

public static class TextareaTestBuilder extends Builder {

0 comments on commit 236632b

Please sign in to comment.
You can’t perform that action at this time.