Skip to content

Commit 24c74c9

Browse files
committed
Merge branch '2.19'
2 parents 4a6a7b4 + ec58aab commit 24c74c9

File tree

87 files changed

+713
-202
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+713
-202
lines changed

protobuf/src/test/java/tools/jackson/dataformat/protobuf/testutil/failure/JacksonTestFailureExpected.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@
2121
*
2222
* @Test
2323
* @JacksonTestFailureExpected
24-
* @Test
25-
public void testFeatureNotYetImplemented() {
24+
*. public void testFeatureNotYetImplemented() {
2625
* // Test code that is expected to fail
2726
* }
28-
* }
2927
* </code></pre>
3028
*
3129
* <p>

smile/src/test/java/perf/ReadPerfUntyped.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import java.util.Map;
44

5-
import tools.jackson.databind.*;
5+
import tools.jackson.databind.ObjectMapper;
66
import tools.jackson.dataformat.smile.SmileFactory;
77

88
public class ReadPerfUntyped extends ReaderTestBase

smile/src/test/java/perf/ReaderTestBase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
import tools.jackson.core.JsonGenerator;
66
import tools.jackson.core.JsonParser;
77

8-
import tools.jackson.databind.*;
8+
import tools.jackson.databind.ObjectMapper;
9+
import tools.jackson.databind.ObjectReader;
910

1011
abstract class ReaderTestBase
1112
{

smile/src/test/java/tools/jackson/dataformat/smile/BaseTestForSmile.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
package tools.jackson.dataformat.smile;
22

3-
import java.io.ByteArrayOutputStream;
4-
import java.io.IOException;
5-
import java.io.InputStream;
6-
import java.io.OutputStream;
3+
import java.io.*;
74
import java.util.Arrays;
85

9-
import org.junit.Assert;
10-
116
import tools.jackson.core.*;
127
import tools.jackson.core.io.ContentReference;
138
import tools.jackson.core.io.IOContext;
149
import tools.jackson.core.util.BufferRecycler;
15-
import tools.jackson.databind.ObjectMapper;
16-
import tools.jackson.databind.ObjectReader;
17-
import tools.jackson.databind.ObjectWriter;
10+
11+
import tools.jackson.databind.*;
1812

1913
import tools.jackson.dataformat.smile.databind.SmileMapper;
2014

15+
import static org.junit.jupiter.api.Assertions.*;
16+
2117
public abstract class BaseTestForSmile
22-
extends junit.framework.TestCase
2318
{
2419
// From JSON specification, sample doc...
2520
protected final static int SAMPLE_SPEC_VALUE_WIDTH = 800;
@@ -253,7 +248,7 @@ protected void verifyException(Throwable e, String... matches)
253248

254249
protected void _verifyBytes(byte[] actBytes, byte... expBytes)
255250
{
256-
Assert.assertArrayEquals(expBytes, actBytes);
251+
assertArrayEquals(expBytes, actBytes);
257252
}
258253

259254
/**
@@ -272,7 +267,7 @@ protected String getAndVerifyText(JsonParser p) throws IOException
272267
if (str.length() != actLen) {
273268
fail("Internal problem (p.token == "+p.currentToken()+"): p.getText().length() ['"+str+"'] == "+str.length()+"; p.getTextLength() == "+actLen);
274269
}
275-
assertEquals("String access via getText(), getTextXxx() must be the same", str, str2);
270+
assertEquals(str, str2, "String access via getText(), getTextXxx() must be the same");
276271

277272
return str;
278273
}

smile/src/test/java/tools/jackson/dataformat/smile/FloatPrecisionTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
package tools.jackson.dataformat.smile;
2+
23
import java.io.ByteArrayOutputStream;
34
import java.math.BigDecimal;
45

6+
import org.junit.jupiter.api.Test;
7+
58
import tools.jackson.core.JsonParser;
69

7-
import static org.junit.Assert.assertArrayEquals;
10+
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
811

912
// for [jackson-core#730]
1013
public class FloatPrecisionTest extends BaseTestForSmile
1114
{
1215
// for [jackson-core#730]
16+
@Test
1317
public void testFloatRoundtrips() throws Exception
1418
{
1519
ByteArrayOutputStream out = new ByteArrayOutputStream();

smile/src/test/java/tools/jackson/dataformat/smile/FormatDefaultsTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
package tools.jackson.dataformat.smile;
22

3+
import org.junit.jupiter.api.Test;
4+
35
import tools.jackson.core.JsonParser;
46
import tools.jackson.core.StreamReadCapability;
57
import tools.jackson.databind.ObjectMapper;
68

9+
import static org.junit.jupiter.api.Assertions.assertTrue;
10+
711
public class FormatDefaultsTest extends BaseTestForSmile
812
{
913
private final ObjectMapper MAPPER = smileMapper();
1014

15+
@Test
1116
public void testParserDefaults() throws Exception
1217
{
1318
try (JsonParser p = MAPPER.createParser(new byte[4])) {

smile/src/test/java/tools/jackson/dataformat/smile/ParserInternalsTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,21 @@
22

33
import java.io.InputStream;
44

5+
import org.junit.jupiter.api.Test;
6+
57
import tools.jackson.core.exc.StreamReadException;
68
import tools.jackson.core.sym.ByteQuadsCanonicalizer;
79

810
import tools.jackson.dataformat.smile.testutil.ThrottledInputStream;
911

12+
import static org.junit.jupiter.api.Assertions.assertEquals;
13+
import static org.junit.jupiter.api.Assertions.fail;
14+
1015
public class ParserInternalsTest extends BaseTestForSmile
1116
{
1217
private final ByteQuadsCanonicalizer ROOT_SYMBOLS = ByteQuadsCanonicalizer.createRoot();
1318

19+
@Test
1420
public void testPositiveVIntGoodCases() throws Exception
1521
{
1622
// First, couple of known good cases
@@ -21,6 +27,7 @@ public void testPositiveVIntGoodCases() throws Exception
2127
});
2228
}
2329

30+
@Test
2431
public void testPositiveVIntOverflows() throws Exception
2532
{
2633
// Bad: ends at 5th, but overflows

smile/src/test/java/tools/jackson/dataformat/smile/SmileFactoryPropertiesTest.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22

33
import java.io.*;
44

5+
import org.junit.jupiter.api.Test;
6+
57
import tools.jackson.core.*;
68
import tools.jackson.core.json.JsonFactory;
79

810
import tools.jackson.databind.ObjectMapper;
911
import tools.jackson.dataformat.smile.async.NonBlockingByteArrayParser;
1012

11-
import static org.junit.Assert.assertArrayEquals;
13+
import static org.junit.jupiter.api.Assertions.*;
1214

13-
/**
14-
* Miscellaneous tests for {@link SmileFactory}, and for some aspects
15-
* of generators and parsers it creates.
16-
*/
1715
public class SmileFactoryPropertiesTest extends BaseTestForSmile
1816
{
1917
private final static String SIMPLE_DOC_AS_JSON = "{\"simple\":[1,true,{}]}";
2018

2119
private final static SmileFactory SMILE_F = new SmileFactory();
20+
21+
@Test
2222
public void testFactoryDefaults() {
2323
SmileFactory f = new SmileFactory();
2424

@@ -33,6 +33,7 @@ public void testFactoryDefaults() {
3333
f.isEnabled(SmileWriteFeature.CHECK_SHARED_STRING_VALUES));
3434
}
3535

36+
@Test
3637
public void testFactorySerializable() throws Exception
3738
{
3839
// Need to handle this in more detail to ensure freeze/thaw'd instances
@@ -52,6 +53,7 @@ public void testFactorySerializable() throws Exception
5253
assertArrayEquals(doc, docOut);
5354
}
5455

56+
@Test
5557
public void testFactoryCopy() throws Exception
5658
{
5759
SmileFactory f2 = SMILE_F.copy();
@@ -72,6 +74,7 @@ public void testFactoryCopy() throws Exception
7274
sg.close();
7375
}
7476

77+
@Test
7578
public void testVersions() throws Exception
7679
{
7780
SmileFactory f = SMILE_F;
@@ -88,13 +91,15 @@ public void testVersions() throws Exception
8891
p.close();
8992
}
9093

94+
@Test
9195
public void testCapabilities() throws Exception
9296
{
9397
assertTrue(SMILE_F.canHandleBinaryNatively());
9498
assertEquals(SmileReadFeature.class, SMILE_F.getFormatReadFeatureType());
9599
assertEquals(SmileWriteFeature.class, SMILE_F.getFormatWriteFeatureType());
96100
}
97101

102+
@Test
98103
public void testInabilityToReadChars() throws Exception
99104
{
100105
final String EXP = "for character-based";
@@ -118,6 +123,7 @@ public void testInabilityToReadChars() throws Exception
118123
}
119124
}
120125

126+
@Test
121127
public void testInabilityToWriteChars() throws Exception
122128
{
123129
try {
@@ -129,6 +135,7 @@ public void testInabilityToWriteChars() throws Exception
129135

130136
}
131137

138+
@Test
132139
public void testCanonicalization() throws Exception
133140
{
134141
try (NonBlockingByteArrayParser parser = new SmileFactory()

smile/src/test/java/tools/jackson/dataformat/smile/SmileUtilTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
package tools.jackson.dataformat.smile;
22

3+
import org.junit.jupiter.api.Test;
4+
5+
import static org.junit.jupiter.api.Assertions.assertEquals;
6+
37
public class SmileUtilTest extends BaseTestForSmile
48
{
59
/**
610
* Verification of helper methods used to handle with zigzag encoding
711
*/
12+
@Test
813
public void testZigZagInt()
914
{
1015
// simple encode
@@ -26,6 +31,7 @@ public void testZigZagInt()
2631
assertEquals(Integer.MAX_VALUE, SmileUtil.zigzagDecode(SmileUtil.zigzagEncode(Integer.MAX_VALUE)));
2732
}
2833

34+
@Test
2935
public void testZigZagLong()
3036
{
3137
assertEquals(0L, SmileUtil.zigzagEncode(0L));

smile/src/test/java/tools/jackson/dataformat/smile/SymbolHandlingTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
package tools.jackson.dataformat.smile;
22

3-
import java.io.IOException;
3+
import org.junit.jupiter.api.Test;
44

55
import tools.jackson.core.JsonToken;
66
import tools.jackson.core.sym.ByteQuadsCanonicalizer;
77

88
import tools.jackson.databind.ObjectMapper;
99

10-
// Tests that have to reside in this package, due to access restrictions
10+
import static org.junit.jupiter.api.Assertions.*;
11+
1112
public class SymbolHandlingTest extends BaseTestForSmile
1213
{
13-
public void testSymbolTable() throws IOException
14+
@Test
15+
public void testSymbolTable() throws Exception
1416
{
1517
ObjectMapper mapper = newSmileMapper();
1618

0 commit comments

Comments
 (0)