File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
core/src/test/java/org/everit/json/schema/internal Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ package org .everit .json .schema .internal ;
2
+
3
+ import static org .junit .Assert .assertFalse ;
4
+ import static org .junit .Assert .assertTrue ;
5
+
6
+ import org .json .JSONString ;
7
+ import org .junit .Test ;
8
+
9
+ public class JSONWriterTest {
10
+
11
+ public static class Ancestor implements JSONString {
12
+
13
+ @ Override public String toJSONString () {
14
+ return null ;
15
+ }
16
+
17
+ }
18
+
19
+ public static class Descendant extends Ancestor {
20
+
21
+ }
22
+
23
+ @ Test
24
+ public void classImplementsJSONString () {
25
+ assertTrue (JSONWriter .implementsJSONString (new Ancestor ()));
26
+ }
27
+
28
+ @ Test
29
+ public void subclassImplementsJSONString () {
30
+ assertTrue (JSONWriter .implementsJSONString (new Descendant ()));
31
+ }
32
+
33
+ @ Test
34
+ public void nullDoesNotImplementJSONString () {
35
+ assertFalse (JSONWriter .implementsJSONString (null ));
36
+ }
37
+
38
+ @ Test
39
+ public void objectDoesNotImplementJSONString () {
40
+ assertFalse (JSONWriter .implementsJSONString (new Object ()));
41
+ }
42
+
43
+ }
You can’t perform that action at this time.
0 commit comments