1
+ package net .minidev .json .test .writer ;
2
+
3
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
4
+ import static org .junit .jupiter .api .Assertions .assertNotNull ;
5
+ import static org .junit .jupiter .api .Assertions .assertNull ;
6
+ import static org .junit .jupiter .api .Assertions .assertSame ;
7
+
8
+ import java .io .IOException ;
9
+ import net .minidev .json .parser .ParseException ;
10
+ import net .minidev .json .writer .FakeMapper ;
11
+ import net .minidev .json .writer .JsonReaderI ;
12
+ import org .junit .jupiter .api .Test ;
13
+
14
+ /** Test for FakeMapper class */
15
+ public class FakeMapperTest {
16
+
17
+ @ Test
18
+ public void testDefaultInstance () {
19
+ assertNotNull (FakeMapper .DEFAULT );
20
+ assertSame (FakeMapper .DEFAULT , FakeMapper .DEFAULT );
21
+ }
22
+
23
+ @ Test
24
+ public void testStartObject () throws ParseException , IOException {
25
+ JsonReaderI <Object > mapper = FakeMapper .DEFAULT ;
26
+ JsonReaderI <?> result = mapper .startObject ("testKey" );
27
+ assertSame (mapper , result );
28
+ }
29
+
30
+ @ Test
31
+ public void testStartArray () throws ParseException , IOException {
32
+ JsonReaderI <Object > mapper = FakeMapper .DEFAULT ;
33
+ JsonReaderI <?> result = mapper .startArray ("testKey" );
34
+ assertSame (mapper , result );
35
+ }
36
+
37
+ @ Test
38
+ public void testSetValue () throws ParseException , IOException {
39
+ JsonReaderI <Object > mapper = FakeMapper .DEFAULT ;
40
+ Object current = new Object ();
41
+ mapper .setValue (current , "key" , "value" );
42
+ }
43
+
44
+ @ Test
45
+ public void testAddValue () throws ParseException , IOException {
46
+ JsonReaderI <Object > mapper = FakeMapper .DEFAULT ;
47
+ Object current = new Object ();
48
+ mapper .addValue (current , "value" );
49
+ }
50
+
51
+ @ Test
52
+ public void testCreateObject () {
53
+ JsonReaderI <Object > mapper = FakeMapper .DEFAULT ;
54
+ Object result = mapper .createObject ();
55
+ assertNull (result );
56
+ }
57
+
58
+ @ Test
59
+ public void testCreateArray () {
60
+ JsonReaderI <Object > mapper = FakeMapper .DEFAULT ;
61
+ Object result = mapper .createArray ();
62
+ assertNull (result );
63
+ }
64
+ }
0 commit comments