4
4
import java .nio .charset .StandardCharsets ;
5
5
import java .nio .file .*;
6
6
7
- import tools .jackson .core .FormatSchema ;
8
- import tools .jackson .core .JsonEncoding ;
9
- import tools .jackson .core .JsonGenerator ;
10
- import tools .jackson .core .JsonParser ;
11
- import tools .jackson .core .JsonToken ;
12
- import tools .jackson .core .ObjectReadContext ;
13
- import tools .jackson .core .ObjectWriteContext ;
14
- import tools .jackson .core .StreamWriteFeature ;
15
- import tools .jackson .core .TokenStreamFactory ;
7
+ import org .junit .jupiter .api .Test ;
8
+
9
+ import tools .jackson .core .*;
16
10
import tools .jackson .core .io .SerializedString ;
17
- import tools .jackson .core .json .JsonFactory ;
18
- import tools .jackson .core .json .JsonFactoryBuilder ;
19
- import tools .jackson .core .json .JsonReadFeature ;
20
- import tools .jackson .core .json .JsonWriteFeature ;
11
+ import tools .jackson .core .json .*;
21
12
import tools .jackson .core .json .async .NonBlockingByteArrayJsonParser ;
22
13
import tools .jackson .core .unittest .*;
23
14
@@ -42,6 +33,7 @@ public String getSchemaType() {
42
33
43
34
private final JsonFactory JSON_F = newStreamFactory ();
44
35
36
+ @ Test
45
37
public void testStreamWriteFeatures () throws Exception
46
38
{
47
39
JsonFactory f = JsonFactory .builder ()
@@ -53,6 +45,7 @@ public void testStreamWriteFeatures() throws Exception
53
45
assertFalse (f .isEnabled (StreamWriteFeature .IGNORE_UNKNOWN ));
54
46
}
55
47
48
+ @ Test
56
49
public void testJsonWriteFeatures () throws Exception
57
50
{
58
51
JsonFactory f = JsonFactory .builder ()
@@ -64,6 +57,7 @@ public void testJsonWriteFeatures() throws Exception
64
57
assertFalse (f .isEnabled (JsonWriteFeature .QUOTE_PROPERTY_NAMES ));
65
58
}
66
59
60
+ @ Test
67
61
public void testFactoryFeatures () throws Exception
68
62
{
69
63
JsonFactory f = JsonFactory .builder ()
@@ -79,6 +73,7 @@ public void testFactoryFeatures() throws Exception
79
73
assertFalse (f .canHandleBinaryNatively ());
80
74
}
81
75
76
+ @ Test
82
77
public void testFactoryMisc () throws Exception
83
78
{
84
79
assertNull (JSON_F .getInputDecorator ());
@@ -91,6 +86,7 @@ public void testFactoryMisc() throws Exception
91
86
assertEquals (JsonWriteFeature .class , JSON_F .getFormatWriteFeatureType ());
92
87
}
93
88
89
+ @ Test
94
90
public void testJsonWithFiles () throws Exception
95
91
{
96
92
File file = File .createTempFile ("jackson-test" , null );
@@ -123,6 +119,7 @@ public void testJsonWithFiles() throws Exception
123
119
file .delete ();
124
120
}
125
121
122
+ @ Test
126
123
public void testCopy () throws Exception
127
124
{
128
125
JsonFactory f = new JsonFactory ();
@@ -149,6 +146,7 @@ public void testCopy() throws Exception
149
146
assertTrue (f .isEnabled (JsonWriteFeature .ESCAPE_NON_ASCII ));
150
147
}
151
148
149
+ @ Test
152
150
public void testRootValues () throws Exception
153
151
{
154
152
assertEquals (" " , JSON_F .getRootValueSeparator ());
@@ -168,6 +166,7 @@ public void testRootValues() throws Exception
168
166
assertEquals ("1/2/3" , w .toString ());
169
167
}
170
168
169
+ @ Test
171
170
public void test_createGenerator_OutputStream () throws Exception
172
171
{
173
172
ByteArrayOutputStream outputStream = new ByteArrayOutputStream ();
@@ -183,6 +182,7 @@ public void test_createGenerator_OutputStream() throws Exception
183
182
outputStream .write (1 );
184
183
}
185
184
185
+ @ Test
186
186
public void test_createGenerator_File () throws Exception
187
187
{
188
188
Path path = Files .createTempFile ("" , "" );
@@ -195,6 +195,7 @@ public void test_createGenerator_File() throws Exception
195
195
assertEquals (new String (Files .readAllBytes (path ), StandardCharsets .UTF_8 ), "\" value\" " );
196
196
}
197
197
198
+ @ Test
198
199
public void test_createGenerator_Path () throws Exception
199
200
{
200
201
Path path = Files .createTempFile ("" , "" );
@@ -207,6 +208,7 @@ public void test_createGenerator_Path() throws Exception
207
208
assertEquals (new String (Files .readAllBytes (path ), StandardCharsets .UTF_8 ), "\" value\" " );
208
209
}
209
210
211
+ @ Test
210
212
public void test_createGenerator_Writer () throws Exception
211
213
{
212
214
Writer writer = new StringWriter ();
@@ -222,6 +224,7 @@ public void test_createGenerator_Writer() throws Exception
222
224
writer .append ('1' );
223
225
}
224
226
227
+ @ Test
225
228
public void test_createGenerator_DataOutput () throws Exception
226
229
{
227
230
ByteArrayOutputStream outputStream = new ByteArrayOutputStream ();
@@ -238,6 +241,7 @@ public void test_createGenerator_DataOutput() throws Exception
238
241
dataOutput .write (1 );
239
242
}
240
243
244
+ @ Test
241
245
public void test_createParser_InputStream () throws Exception
242
246
{
243
247
InputStream inputStream = new ByteArrayInputStream ("\" value\" " .getBytes (StandardCharsets .UTF_8 ));
@@ -247,6 +251,7 @@ public void test_createParser_InputStream() throws Exception
247
251
assertEquals (jsonParser .nextStringValue (), "value" );
248
252
}
249
253
254
+ @ Test
250
255
public void test_createParser_File () throws Exception
251
256
{
252
257
Path path = Files .createTempFile ("" , "" );
@@ -257,6 +262,7 @@ public void test_createParser_File() throws Exception
257
262
assertEquals (jsonParser .nextStringValue (), "value" );
258
263
}
259
264
265
+ @ Test
260
266
public void test_createParser_Path () throws Exception
261
267
{
262
268
Path path = Files .createTempFile ("" , "" );
@@ -267,6 +273,7 @@ public void test_createParser_Path() throws Exception
267
273
assertEquals (jsonParser .nextStringValue (), "value" );
268
274
}
269
275
276
+ @ Test
270
277
public void test_createParser_Url () throws Exception
271
278
{
272
279
Path path = Files .createTempFile ("" , "" );
@@ -277,6 +284,7 @@ public void test_createParser_Url() throws Exception
277
284
assertEquals (jsonParser .nextStringValue (), "value" );
278
285
}
279
286
287
+ @ Test
280
288
public void test_createParser_Reader () throws Exception
281
289
{
282
290
Reader reader = new StringReader ("\" value\" " );
@@ -286,6 +294,7 @@ public void test_createParser_Reader() throws Exception
286
294
assertEquals (jsonParser .nextStringValue (), "value" );
287
295
}
288
296
297
+ @ Test
289
298
public void test_createParser_ByteArray () throws Exception
290
299
{
291
300
byte [] bytes = "\" value\" " .getBytes (StandardCharsets .UTF_8 );
@@ -295,6 +304,7 @@ public void test_createParser_ByteArray() throws Exception
295
304
assertEquals (jsonParser .nextStringValue (), "value" );
296
305
}
297
306
307
+ @ Test
298
308
public void test_createParser_String () throws Exception
299
309
{
300
310
String string = "\" value\" " ;
@@ -304,6 +314,7 @@ public void test_createParser_String() throws Exception
304
314
assertEquals (jsonParser .nextStringValue (), "value" );
305
315
}
306
316
317
+ @ Test
307
318
public void test_createParser_CharArray () throws Exception
308
319
{
309
320
char [] chars = "\" value\" " .toCharArray ();
@@ -313,6 +324,7 @@ public void test_createParser_CharArray() throws Exception
313
324
assertEquals (jsonParser .nextStringValue (), "value" );
314
325
}
315
326
327
+ @ Test
316
328
public void test_createParser_DataInput () throws Exception
317
329
{
318
330
InputStream inputStream = new ByteArrayInputStream ("\" value\" " .getBytes (StandardCharsets .UTF_8 ));
@@ -323,11 +335,12 @@ public void test_createParser_DataInput() throws Exception
323
335
assertEquals (jsonParser .nextStringValue (), "value" );
324
336
}
325
337
326
-
338
+ @ Test
327
339
public void testCanonicalizationEnabled () throws Exception {
328
340
doCanonicalizationTest (false );
329
341
}
330
342
343
+ @ Test
331
344
public void testCanonicalizationDisabled () throws Exception {
332
345
doCanonicalizationTest (false );
333
346
}
0 commit comments