This repository was archived by the owner on Oct 23, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +28
-18
lines changed
src/test/java/com/alibaba Expand file tree Collapse file tree 2 files changed +28
-18
lines changed Original file line number Diff line number Diff line change 88import java .io .ByteArrayInputStream ;
99
1010public class JSONValidateTest_0 extends TestCase {
11- public void test_validate () throws Exception {
12- String json = JSON .toJSONString (EishayDecodeBytes .instance .getContent ());
13- JSONValidator validator = JSONValidator .from (json );
14- assertTrue (validator .validate ());
15- }
16-
1711 public void test_validate_benchmark () throws Exception {
1812 String json = JSON .toJSONString (EishayDecodeBytes .instance .getContent ());
1913
@@ -27,20 +21,8 @@ public void test_validate_benchmark() throws Exception {
2721 }
2822 }
2923
30- public void test_validate_utf8 () throws Exception {
31- byte [] json = JSON .toJSONBytes (EishayDecodeBytes .instance .getContent ());
32-
33- JSONValidator validator = JSONValidator .fromUtf8 (json );
34- assertTrue (validator .validate ());
35- }
3624
37- public void test_validate_utf8_stream () throws Exception {
38- byte [] json = JSON .toJSONBytes (EishayDecodeBytes .instance .getContent ());
3925
40- JSONValidator validator = JSONValidator .fromUtf8 (new ByteArrayInputStream (json ));
41- assertTrue (validator .validate ());
42- validator .close ();
43- }
4426
4527 public void test_validate_utf8_benchmark () throws Exception {
4628 byte [] json = JSON .toJSONBytes (EishayDecodeBytes .instance .getContent ());
Original file line number Diff line number Diff line change 11package com .alibaba .json .bvt .validate ;
22
3+ import com .alibaba .fastjson .JSON ;
34import com .alibaba .fastjson .JSONValidator ;
5+ import com .alibaba .json .test .benchmark .decode .EishayDecodeBytes ;
46import org .junit .Test ;
57
8+ import java .io .ByteArrayInputStream ;
9+
610import static org .junit .Assert .*;
711
812public class JSONValidatorTest {
@@ -72,4 +76,28 @@ public void validate_test_tfn() throws Throwable {
7276 boolean isValidate = JSONValidator .from ("trua" ).validate ();
7377 assertFalse (isValidate );
7478 }
79+
80+ @ Test
81+ public void test_validate_utf8 () throws Exception {
82+ byte [] json = JSON .toJSONBytes (EishayDecodeBytes .instance .getContent ());
83+
84+ JSONValidator validator = JSONValidator .fromUtf8 (json );
85+ assertTrue (validator .validate ());
86+ }
87+
88+ @ Test
89+ public void test_validate_utf8_stream () throws Exception {
90+ byte [] json = JSON .toJSONBytes (EishayDecodeBytes .instance .getContent ());
91+
92+ JSONValidator validator = JSONValidator .fromUtf8 (new ByteArrayInputStream (json ));
93+ assertTrue (validator .validate ());
94+ validator .close ();
95+ }
96+
97+ @ Test
98+ public void test_validate () throws Exception {
99+ String json = JSON .toJSONString (EishayDecodeBytes .instance .getContent ());
100+ JSONValidator validator = JSONValidator .from (json );
101+ assertTrue (validator .validate ());
102+ }
75103}
You can’t perform that action at this time.
0 commit comments