9
9
import static org .junit .jupiter .api .Assertions .assertEquals ;
10
10
11
11
public class JSONWriterUTF8JDK9Test {
12
- @ Test
13
- public void test_writeString () {
14
- JSONWriterUTF8JDK9 jsonWriter = new JSONWriterUTF8JDK9 (JSONFactory .createWriteContext ());
15
- jsonWriter .writeString ((String ) null );
16
- assertEquals ("null" , jsonWriter .toString ());
17
- }
18
-
19
12
@ Test
20
13
public void test_writeString_1 () {
21
14
if (STRING_VALUE == null ) {
22
15
return ;
23
16
}
24
17
25
- JSONWriterUTF8JDK9 jsonWriter = new JSONWriterUTF8JDK9 (JSONFactory .createWriteContext ());
18
+ JSONWriterUTF8 jsonWriter = new JSONWriterUTF8 (JSONFactory .createWriteContext ());
26
19
jsonWriter .writeString ("a" );
27
20
assertEquals ("\" a\" " , jsonWriter .toString ());
28
21
}
@@ -33,7 +26,7 @@ public void test_writeString_2() {
33
26
return ;
34
27
}
35
28
36
- JSONWriterUTF8JDK9 jsonWriter = new JSONWriterUTF8JDK9 (JSONFactory .createWriteContext ());
29
+ JSONWriterUTF8 jsonWriter = new JSONWriterUTF8 (JSONFactory .createWriteContext ());
37
30
jsonWriter .writeString ("\" \" " );
38
31
assertEquals ("\" \\ \" \\ \" \" " , jsonWriter .toString ());
39
32
}
@@ -44,7 +37,7 @@ public void test_writeString_3() {
44
37
return ;
45
38
}
46
39
47
- JSONWriterUTF8JDK9 jsonWriter = new JSONWriterUTF8JDK9 (JSONFactory .createWriteContext ());
40
+ JSONWriterUTF8 jsonWriter = new JSONWriterUTF8 (JSONFactory .createWriteContext ());
48
41
jsonWriter .writeString ("abc" );
49
42
assertEquals ("\" abc\" " , jsonWriter .toString ());
50
43
}
@@ -55,7 +48,7 @@ public void test_writeString_4() {
55
48
return ;
56
49
}
57
50
58
- JSONWriterUTF8JDK9 jsonWriter = new JSONWriterUTF8JDK9 (JSONFactory .createWriteContext ());
51
+ JSONWriterUTF8 jsonWriter = new JSONWriterUTF8 (JSONFactory .createWriteContext ());
59
52
jsonWriter .writeString ("abcdefghijklmn01234567890" );
60
53
assertEquals ("\" abcdefghijklmn01234567890\" " , jsonWriter .toString ());
61
54
}
@@ -66,7 +59,7 @@ public void test_writeString_utf8() {
66
59
return ;
67
60
}
68
61
69
- JSONWriterUTF8JDK9 jsonWriter = new JSONWriterUTF8JDK9 (JSONFactory .createWriteContext ());
62
+ JSONWriterUTF8 jsonWriter = new JSONWriterUTF8 (JSONFactory .createWriteContext ());
70
63
jsonWriter .writeString ("中国" );
71
64
assertEquals ("\" 中国\" " , jsonWriter .toString ());
72
65
}
@@ -77,7 +70,7 @@ public void test_writeString_utf8_1() {
77
70
return ;
78
71
}
79
72
80
- JSONWriterUTF8JDK9 jsonWriter = new JSONWriterUTF8JDK9 (JSONFactory .createWriteContext ());
73
+ JSONWriterUTF8 jsonWriter = new JSONWriterUTF8 (JSONFactory .createWriteContext ());
81
74
jsonWriter .writeString ("^á" );
82
75
assertEquals ("\" ^á\" " , jsonWriter .toString ());
83
76
}
@@ -96,7 +89,7 @@ public void test_writeString_utf82() {
96
89
buf .append ('á' );
97
90
String origin = buf .toString ();
98
91
99
- JSONWriterUTF8JDK9 jsonWriter = new JSONWriterUTF8JDK9 (JSONFactory .createWriteContext ());
92
+ JSONWriterUTF8 jsonWriter = new JSONWriterUTF8 (JSONFactory .createWriteContext ());
100
93
jsonWriter .writeString (origin );
101
94
String json = jsonWriter .toString ();
102
95
String str = (String ) JSON .parse (json );
@@ -113,7 +106,7 @@ public void test_writeString_utf8_3() {
113
106
return ;
114
107
}
115
108
116
- JSONWriterUTF8JDK9 jsonWriter = new JSONWriterUTF8JDK9 (JSONFactory .createWriteContext ());
109
+ JSONWriterUTF8 jsonWriter = new JSONWriterUTF8 (JSONFactory .createWriteContext ());
117
110
118
111
JSONObject map = new JSONObject ();
119
112
map .put ("^á" , 0 );
@@ -130,7 +123,7 @@ public void test_writeString_special() {
130
123
return ;
131
124
}
132
125
133
- JSONWriterUTF8JDK9 jsonWriter = new JSONWriterUTF8JDK9 (JSONFactory .createWriteContext ());
126
+ JSONWriterUTF8 jsonWriter = new JSONWriterUTF8 (JSONFactory .createWriteContext ());
134
127
jsonWriter .writeString ("\r \n \t \f \b \" " );
135
128
assertEquals ("\" \\ r\\ n\\ t\\ f\\ b\\ \" \" " , jsonWriter .toString ());
136
129
}
@@ -143,7 +136,7 @@ public void test_writeString_large() {
143
136
144
137
char [] chars = new char [2048 ];
145
138
Arrays .fill (chars , 'a' );
146
- JSONWriterUTF8JDK9 jsonWriter = new JSONWriterUTF8JDK9 (JSONFactory .createWriteContext ());
139
+ JSONWriterUTF8 jsonWriter = new JSONWriterUTF8 (JSONFactory .createWriteContext ());
147
140
jsonWriter .writeString (new String (chars ));
148
141
assertEquals (chars .length + 2 , jsonWriter .toString ().length ());
149
142
}
0 commit comments