Skip to content

Commit

Permalink
fixed testcase - special linebreaks are not longer supported
Browse files Browse the repository at this point in the history
  • Loading branch information
grobmeier committed Mar 17, 2012
1 parent 7b69280 commit db90fea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -54,21 +54,22 @@ public void testMultiline() throws Exception {
charArray[i++] = 'g'; charArray[i++] = 'g';
String part1 = new String(charArray); String part1 = new String(charArray);


char[] charArray2 = new char[7]; char[] charArray2 = new char[6];

i = 0; i = 0;
charArray2[i++] = 'm'; charArray2[i++] = 'm';
charArray2[i++] = 'y'; charArray2[i++] = 'y';
charArray2[i++] = '%'; charArray2[i++] = '\\';
charArray2[i++] = '0'; charArray2[i++] = 'n';
charArray2[i++] = 'A';
charArray2[i++] = 'a'; charArray2[i++] = 'a';
charArray2[i++] = 'g'; charArray2[i++] = 'g';
String part2 = new String(charArray2); String part2 = new String(charArray2);


String executeAction = this.executeAction("/multilinetest"); String executeAction = this.executeAction("/multilinetest");


String expected = "{\"test\":\"" + part1 + "\",\"test2\":\"" + part2 + "\"}"; String expected = "{\"test\":\"" + part1 + "\",\"test2\":\"" + part2 + "\"}";
System.out.println(expected);
System.out.println(executeAction);
Assert.assertEquals(expected, executeAction); Assert.assertEquals(expected, executeAction);
} }
} }
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -26,19 +26,18 @@ public class MultilineTestAction extends ActionSupport {


private static final char[] charArray = new char[5]; private static final char[] charArray = new char[5];
static { static {

int i = 0;
int i = 0; charArray[i++] = 'm';
charArray[i++] = 'm'; charArray[i++] = 'y';
charArray[i++] = 'y'; charArray[i++] = '\n';
charArray[i++] = '\n'; charArray[i++] = 'a';
charArray[i++] = 'a'; charArray[i++] = 'g';
charArray[i++] = 'g';
} }


@JSON(encodeLinebreaks = true) @JSON
private String test = new String(charArray); private String test = new String(charArray);


@JSON(replaceLinebreaksWith = "%0A") @JSON
private String test2 = "my\nag"; private String test2 = "my\nag";


public String execute(){ public String execute(){
Expand Down

0 comments on commit db90fea

Please sign in to comment.