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 +13
-1
lines changed
main/java/com/alibaba/fastjson
test/java/com/alibaba/json/bvt/validate Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 11package com .alibaba .fastjson ;
22
3+ import java .io .Closeable ;
34import java .io .IOException ;
45import java .io .InputStream ;
56import java .io .Reader ;
67
7- public abstract class JSONValidator implements Cloneable {
8+ public abstract class JSONValidator implements Cloneable , Closeable {
89 public enum Type {
910 Object , Array , Value
1011 }
Original file line number Diff line number Diff line change 66import org .junit .Test ;
77
88import java .io .ByteArrayInputStream ;
9+ import java .io .StringReader ;
910
1011import static org .junit .Assert .*;
1112
@@ -100,4 +101,14 @@ public void test_validate() throws Exception {
100101 JSONValidator validator = JSONValidator .from (json );
101102 assertTrue (validator .validate ());
102103 }
104+
105+ @ Test
106+ public void test_validate_reader () throws Exception {
107+ JSONValidator validator = JSONValidator .from (
108+ new StringReader (
109+ new String (
110+ JSON .toJSONBytes (EishayDecodeBytes .instance .getContent ()))));
111+ assertTrue (validator .validate ());
112+ validator .close ();
113+ }
103114}
You can’t perform that action at this time.
0 commit comments