Skip to content

Commit 4ffe83f

Browse files
committed
Merge parts of #1411
1 parent 80b4a42 commit 4ffe83f

File tree

2 files changed

+28
-15
lines changed

2 files changed

+28
-15
lines changed

src/main/java/tools/jackson/core/StreamWriteFeature.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public enum StreamWriteFeature
122122
* NOTE! Enabling this feature appears to improve performance significantly
123123
* up to and including JDK 17, but NOT when using JDK 21
124124
* and above -- in fact, it seems that JDK implementation is slightly faster.
125-
* Because of this,enabling this feature is only recommended for JDKs 17 and below.
125+
* Because of this, enabling this feature is only recommended for JDKs 17 and below.
126126
*<p>
127127
* Feature is disabled by default, meaning that JDK default conversions are used.
128128
*/

src/test/java/tools/jackson/core/unittest/json/JsonFactoryTest.java

+27-14
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,11 @@
44
import java.nio.charset.StandardCharsets;
55
import java.nio.file.*;
66

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.*;
1610
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.*;
2112
import tools.jackson.core.json.async.NonBlockingByteArrayJsonParser;
2213
import tools.jackson.core.unittest.*;
2314

@@ -42,6 +33,7 @@ public String getSchemaType() {
4233

4334
private final JsonFactory JSON_F = newStreamFactory();
4435

36+
@Test
4537
public void testStreamWriteFeatures() throws Exception
4638
{
4739
JsonFactory f = JsonFactory.builder()
@@ -53,6 +45,7 @@ public void testStreamWriteFeatures() throws Exception
5345
assertFalse(f.isEnabled(StreamWriteFeature.IGNORE_UNKNOWN));
5446
}
5547

48+
@Test
5649
public void testJsonWriteFeatures() throws Exception
5750
{
5851
JsonFactory f = JsonFactory.builder()
@@ -64,6 +57,7 @@ public void testJsonWriteFeatures() throws Exception
6457
assertFalse(f.isEnabled(JsonWriteFeature.QUOTE_PROPERTY_NAMES));
6558
}
6659

60+
@Test
6761
public void testFactoryFeatures() throws Exception
6862
{
6963
JsonFactory f = JsonFactory.builder()
@@ -79,6 +73,7 @@ public void testFactoryFeatures() throws Exception
7973
assertFalse(f.canHandleBinaryNatively());
8074
}
8175

76+
@Test
8277
public void testFactoryMisc() throws Exception
8378
{
8479
assertNull(JSON_F.getInputDecorator());
@@ -91,6 +86,7 @@ public void testFactoryMisc() throws Exception
9186
assertEquals(JsonWriteFeature.class, JSON_F.getFormatWriteFeatureType());
9287
}
9388

89+
@Test
9490
public void testJsonWithFiles() throws Exception
9591
{
9692
File file = File.createTempFile("jackson-test", null);
@@ -123,6 +119,7 @@ public void testJsonWithFiles() throws Exception
123119
file.delete();
124120
}
125121

122+
@Test
126123
public void testCopy() throws Exception
127124
{
128125
JsonFactory f = new JsonFactory();
@@ -149,6 +146,7 @@ public void testCopy() throws Exception
149146
assertTrue(f.isEnabled(JsonWriteFeature.ESCAPE_NON_ASCII));
150147
}
151148

149+
@Test
152150
public void testRootValues() throws Exception
153151
{
154152
assertEquals(" ", JSON_F.getRootValueSeparator());
@@ -168,6 +166,7 @@ public void testRootValues() throws Exception
168166
assertEquals("1/2/3", w.toString());
169167
}
170168

169+
@Test
171170
public void test_createGenerator_OutputStream() throws Exception
172171
{
173172
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
@@ -183,6 +182,7 @@ public void test_createGenerator_OutputStream() throws Exception
183182
outputStream.write(1);
184183
}
185184

185+
@Test
186186
public void test_createGenerator_File() throws Exception
187187
{
188188
Path path = Files.createTempFile("", "");
@@ -195,6 +195,7 @@ public void test_createGenerator_File() throws Exception
195195
assertEquals(new String(Files.readAllBytes(path), StandardCharsets.UTF_8), "\"value\"");
196196
}
197197

198+
@Test
198199
public void test_createGenerator_Path() throws Exception
199200
{
200201
Path path = Files.createTempFile("", "");
@@ -207,6 +208,7 @@ public void test_createGenerator_Path() throws Exception
207208
assertEquals(new String(Files.readAllBytes(path), StandardCharsets.UTF_8), "\"value\"");
208209
}
209210

211+
@Test
210212
public void test_createGenerator_Writer() throws Exception
211213
{
212214
Writer writer = new StringWriter();
@@ -222,6 +224,7 @@ public void test_createGenerator_Writer() throws Exception
222224
writer.append('1');
223225
}
224226

227+
@Test
225228
public void test_createGenerator_DataOutput() throws Exception
226229
{
227230
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
@@ -238,6 +241,7 @@ public void test_createGenerator_DataOutput() throws Exception
238241
dataOutput.write(1);
239242
}
240243

244+
@Test
241245
public void test_createParser_InputStream() throws Exception
242246
{
243247
InputStream inputStream = new ByteArrayInputStream("\"value\"".getBytes(StandardCharsets.UTF_8));
@@ -247,6 +251,7 @@ public void test_createParser_InputStream() throws Exception
247251
assertEquals(jsonParser.nextStringValue(), "value");
248252
}
249253

254+
@Test
250255
public void test_createParser_File() throws Exception
251256
{
252257
Path path = Files.createTempFile("", "");
@@ -257,6 +262,7 @@ public void test_createParser_File() throws Exception
257262
assertEquals(jsonParser.nextStringValue(), "value");
258263
}
259264

265+
@Test
260266
public void test_createParser_Path() throws Exception
261267
{
262268
Path path = Files.createTempFile("", "");
@@ -267,6 +273,7 @@ public void test_createParser_Path() throws Exception
267273
assertEquals(jsonParser.nextStringValue(), "value");
268274
}
269275

276+
@Test
270277
public void test_createParser_Url() throws Exception
271278
{
272279
Path path = Files.createTempFile("", "");
@@ -277,6 +284,7 @@ public void test_createParser_Url() throws Exception
277284
assertEquals(jsonParser.nextStringValue(), "value");
278285
}
279286

287+
@Test
280288
public void test_createParser_Reader() throws Exception
281289
{
282290
Reader reader = new StringReader("\"value\"");
@@ -286,6 +294,7 @@ public void test_createParser_Reader() throws Exception
286294
assertEquals(jsonParser.nextStringValue(), "value");
287295
}
288296

297+
@Test
289298
public void test_createParser_ByteArray() throws Exception
290299
{
291300
byte[] bytes = "\"value\"".getBytes(StandardCharsets.UTF_8);
@@ -295,6 +304,7 @@ public void test_createParser_ByteArray() throws Exception
295304
assertEquals(jsonParser.nextStringValue(), "value");
296305
}
297306

307+
@Test
298308
public void test_createParser_String() throws Exception
299309
{
300310
String string = "\"value\"";
@@ -304,6 +314,7 @@ public void test_createParser_String() throws Exception
304314
assertEquals(jsonParser.nextStringValue(), "value");
305315
}
306316

317+
@Test
307318
public void test_createParser_CharArray() throws Exception
308319
{
309320
char[] chars = "\"value\"".toCharArray();
@@ -313,6 +324,7 @@ public void test_createParser_CharArray() throws Exception
313324
assertEquals(jsonParser.nextStringValue(), "value");
314325
}
315326

327+
@Test
316328
public void test_createParser_DataInput() throws Exception
317329
{
318330
InputStream inputStream = new ByteArrayInputStream("\"value\"".getBytes(StandardCharsets.UTF_8));
@@ -323,11 +335,12 @@ public void test_createParser_DataInput() throws Exception
323335
assertEquals(jsonParser.nextStringValue(), "value");
324336
}
325337

326-
338+
@Test
327339
public void testCanonicalizationEnabled() throws Exception {
328340
doCanonicalizationTest(false);
329341
}
330342

343+
@Test
331344
public void testCanonicalizationDisabled() throws Exception {
332345
doCanonicalizationTest(false);
333346
}

0 commit comments

Comments
 (0)