Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit 12d92f6

Browse files
committed
refactor validate testcase
1 parent 50532a4 commit 12d92f6

File tree

2 files changed

+28
-18
lines changed

2 files changed

+28
-18
lines changed

src/test/java/com/alibaba/fastjson/validate/JSONValidateTest_0.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@
88
import java.io.ByteArrayInputStream;
99

1010
public 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());

src/test/java/com/alibaba/json/bvt/validate/JSONValidatorTest.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
package com.alibaba.json.bvt.validate;
22

3+
import com.alibaba.fastjson.JSON;
34
import com.alibaba.fastjson.JSONValidator;
5+
import com.alibaba.json.test.benchmark.decode.EishayDecodeBytes;
46
import org.junit.Test;
57

8+
import java.io.ByteArrayInputStream;
9+
610
import static org.junit.Assert.*;
711

812
public 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
}

0 commit comments

Comments
 (0)