From bae7900ed913230465cdf2ad2b8fd83c7801633a Mon Sep 17 00:00:00 2001 From: "shaojin.wensj" Date: Sun, 17 Apr 2022 16:39:29 +0800 Subject: [PATCH] fix compile error && add gitignore --- .gitignore | 2 + fastjson1_compatible/pom.xml | 9 ++ .../json/bvt/issue_3600/Issue3689.java | 89 ++++++++++++------- 3 files changed, 69 insertions(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index 90264b40c6..5e612d3d5e 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,8 @@ *.tar.gz *.rar +*.iml + # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* /.idea/ diff --git a/fastjson1_compatible/pom.xml b/fastjson1_compatible/pom.xml index 83d20f9397..f2b2c7c5eb 100644 --- a/fastjson1_compatible/pom.xml +++ b/fastjson1_compatible/pom.xml @@ -50,6 +50,15 @@ + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M6 + + true + + + org.apache.maven.plugins maven-source-plugin diff --git a/fastjson1_compatible/src/test/java/com/alibaba/json/bvt/issue_3600/Issue3689.java b/fastjson1_compatible/src/test/java/com/alibaba/json/bvt/issue_3600/Issue3689.java index ba1cbbb49a..26fdada7e9 100644 --- a/fastjson1_compatible/src/test/java/com/alibaba/json/bvt/issue_3600/Issue3689.java +++ b/fastjson1_compatible/src/test/java/com/alibaba/json/bvt/issue_3600/Issue3689.java @@ -4,80 +4,107 @@ import com.alibaba.fastjson.JSONException; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertThrows; + public class Issue3689 { - @Test(expected = JSONException.class) + @Test public void test_without_type_0_meaningles_char() { - JSONArray.parseArray("dfdfdf"); + assertThrows(com.alibaba.fastjson2.JSONException.class, () -> { + JSONArray.parseArray("dfdfdf"); + }); } - @Test(expected = JSONException.class) + @Test public void test_without_type_1_meaningles_char() { - JSONArray.parseArray("/dfdfdf"); + assertThrows(com.alibaba.fastjson2.JSONException.class, () -> { + JSONArray.parseArray("/dfdfdf"); + }); } - @Test(expected = JSONException.class) + @Test public void test_without_type_2_meaningles_char() { - JSONArray.parseArray("//dfdfdf"); + assertThrows(com.alibaba.fastjson2.JSONException.class, () -> { + JSONArray.parseArray("//dfdfdf"); + }); } - @Test(expected = JSONException.class) + @Test public void test_without_type_3_meaningles_char() { - JSONArray.parseArray("///dfdfdf"); + assertThrows(com.alibaba.fastjson2.JSONException.class, () -> { + JSONArray.parseArray("///dfdfdf"); + }); } - @Test(expected = JSONException.class) + @Test public void test_without_type_4_meaningles_char() { - JSONArray.parseArray("////dfdfdf"); + assertThrows(com.alibaba.fastjson2.JSONException.class, () -> { + JSONArray.parseArray("////dfdfdf"); + }); } - @Test(expected = JSONException.class) + @Test public void test_without_type_5_meaningles_char() { - JSONArray.parseArray("/////dfdfdf"); + assertThrows(com.alibaba.fastjson2.JSONException.class, () -> { + JSONArray.parseArray("/////dfdfdf"); + }); } - @Test(expected = JSONException.class) + @Test public void test_without_type_6_meaningles_char() { - JSONArray.parseArray("//////dfdfdf"); + assertThrows(com.alibaba.fastjson2.JSONException.class, () -> { + JSONArray.parseArray("//////dfdfdf"); + }); } - @Test(expected = JSONException.class) + @Test public void test_with_type_0_meaningles_char() { - JSONArray.parseArray("dfdfdf", String.class); + assertThrows(com.alibaba.fastjson.JSONException.class, () -> { + JSONArray.parseArray("dfdfdf", String.class); + }); } - @Test(expected = JSONException.class) + @Test public void test_with_type_1_meaningles_char() { - JSONArray.parseArray("/dfdfdf", String.class); + assertThrows(com.alibaba.fastjson.JSONException.class, () -> { + JSONArray.parseArray("/dfdfdf", String.class); + }); } - @Test(expected = JSONException.class) + @Test public void test_with_type_2_meaningles_char() { - JSONArray.parseArray("//dfdfdf", String.class); + assertThrows(com.alibaba.fastjson.JSONException.class, () -> { + JSONArray.parseArray("//dfdfdf", String.class); + }); } - @Test(expected = JSONException.class) + @Test public void test_with_type_3_meaningles_char() { - JSONArray.parseArray("///dfdfdf", String.class); - + assertThrows(com.alibaba.fastjson.JSONException.class, () -> { + JSONArray.parseArray("///dfdfdf", String.class); + }); } - @Test(expected = JSONException.class) + @Test public void test_with_type_4_meaningles_char() { - JSONArray.parseArray("////dfdfdf", String.class); - + assertThrows(com.alibaba.fastjson.JSONException.class, () -> { + JSONArray.parseArray("////dfdfdf", String.class); + }); } - @Test(expected = JSONException.class) + @Test public void test_with_type_5_meaningles_char() { - JSONArray.parseArray("/////dfdfdf", String.class); - + assertThrows(com.alibaba.fastjson.JSONException.class, () -> { + JSONArray.parseArray("/////dfdfdf", String.class); + }); } - @Test(expected = JSONException.class) + @Test public void test_with_type_6_meaningles_char() { - JSONArray.parseArray("//////dfdfdf", String.class); + assertThrows(JSONException.class, () -> { + JSONArray.parseArray("//////dfdfdf", String.class); + }); } @Test