forked from alibaba/fastjson
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug fixed for \u001A serialize, fixed issue 304. alibaba#304
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 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
43 changes: 43 additions & 0 deletions
43
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_304.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,43 @@ | ||
package com.alibaba.json.bvt.bug; | ||
|
||
import org.junit.Assert; | ||
|
||
import com.alibaba.fastjson.JSON; | ||
|
||
import junit.framework.TestCase; | ||
|
||
public class Bug_for_issue_304 extends TestCase { | ||
|
||
public void test_doubleQuote() throws Exception { | ||
String ss = "{\"value\":\"Intki_E96?\u001A Build\"}"; | ||
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss).get("value")); | ||
} | ||
|
||
public void test_doubleQuote_vo() throws Exception { | ||
String ss = "{\"value\":\"Intki_E96?\u001A Build\"}"; | ||
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss, VO.class).value); | ||
} | ||
|
||
public void test_doubleQuote_vo_private() throws Exception { | ||
String ss = "{\"value\":\"Intki_E96?\u001A Build\"}"; | ||
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss, V1.class).value); | ||
} | ||
|
||
public void test_singleQuote() throws Exception { | ||
String ss = "{'value':'Intki_E96?\u001A Build'}"; | ||
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss).get("value")); | ||
} | ||
|
||
public void test_singleQuote_vo() throws Exception { | ||
String ss = "{'value':'Intki_E96?\u001A Build'}"; | ||
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss, VO.class).value); | ||
} | ||
|
||
public static class VO { | ||
public String value; | ||
} | ||
|
||
private static class V1 { | ||
public String value; | ||
} | ||
} |