Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed testcase - special linebreaks are not longer supported

  • Loading branch information...
commit db90feab4037d55b2f7148c78c8ae47a9fe96de8 1 parent 7b69280
@grobmeier authored
View
11 jjson-struts2/src/test/java/de/grobmeier/json/plugins/struts2/JsonResultTest.java
@@ -54,14 +54,13 @@ public void testMultiline() throws Exception {
charArray[i++] = 'g';
String part1 = new String(charArray);
- char[] charArray2 = new char[7];
-
+ char[] charArray2 = new char[6];
+
i = 0;
charArray2[i++] = 'm';
charArray2[i++] = 'y';
- charArray2[i++] = '%';
- charArray2[i++] = '0';
- charArray2[i++] = 'A';
+ charArray2[i++] = '\\';
+ charArray2[i++] = 'n';
charArray2[i++] = 'a';
charArray2[i++] = 'g';
String part2 = new String(charArray2);
@@ -69,6 +68,8 @@ public void testMultiline() throws Exception {
String executeAction = this.executeAction("/multilinetest");
String expected = "{\"test\":\"" + part1 + "\",\"test2\":\"" + part2 + "\"}";
+ System.out.println(expected);
+ System.out.println(executeAction);
Assert.assertEquals(expected, executeAction);
}
}
View
17 jjson-struts2/src/test/java/de/grobmeier/json/plugins/struts2/MultilineTestAction.java
@@ -26,19 +26,18 @@
private static final char[] charArray = new char[5];
static {
-
- int i = 0;
- charArray[i++] = 'm';
- charArray[i++] = 'y';
- charArray[i++] = '\n';
- charArray[i++] = 'a';
- charArray[i++] = 'g';
+ int i = 0;
+ charArray[i++] = 'm';
+ charArray[i++] = 'y';
+ charArray[i++] = '\n';
+ charArray[i++] = 'a';
+ charArray[i++] = 'g';
}
- @JSON(encodeLinebreaks = true)
+ @JSON
private String test = new String(charArray);
- @JSON(replaceLinebreaksWith = "%0A")
+ @JSON
private String test2 = "my\nag";
public String execute(){
Please sign in to comment.
Something went wrong with that request. Please try again.