Skip to content

Commit 4243b09

Browse files
committed
Migrate smile module tests to JUnit 5
1 parent 55970d8 commit 4243b09

File tree

9 files changed

+21
-25
lines changed

9 files changed

+21
-25
lines changed

smile/src/test/java/com/fasterxml/jackson/dataformat/smile/BaseTestForSmile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ protected String getAndVerifyText(JsonParser p) throws IOException
225225
if (str.length() != actLen) {
226226
fail("Internal problem (p.token == "+p.getCurrentToken()+"): p.getText().length() ['"+str+"'] == "+str.length()+"; p.getTextLength() == "+actLen);
227227
}
228-
assertEquals("String access via getText(), getTextXxx() must be the same", str, str2);
228+
assertEquals(str, str2, "String access via getText(), getTextXxx() must be the same");
229229

230230
return str;
231231
}

smile/src/test/java/com/fasterxml/jackson/dataformat/smile/async/SimpleStringArrayTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ public void testLongAsciiStringsLowStringLimit() throws IOException
141141
r.currentText();
142142
fail("expected StreamConstraintsException");
143143
} catch (StreamConstraintsException ise) {
144-
assertTrue("unexpected exception message: " + ise.getMessage(),
145-
ise.getMessage().startsWith("String value length (98) exceeds the maximum allowed"));
144+
assertTrue(ise.getMessage().startsWith("String value length (98) exceeds the maximum allowed"),
145+
"unexpected exception message: " + ise.getMessage());
146146
}
147147
}
148148

smile/src/test/java/com/fasterxml/jackson/dataformat/smile/gen/TestGeneratorWithRawUtf8.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,20 +166,20 @@ private void doTestIssue492(boolean asUtf8String) throws Exception
166166
assertToken(parser.nextToken(), JsonToken.START_OBJECT);
167167

168168
assertToken(parser.nextToken(), JsonToken.FIELD_NAME);
169-
assertEquals(parser.currentName(), "name");
169+
assertEquals("name", parser.currentName());
170170
assertToken(parser.nextToken(), JsonToken.VALUE_STRING);
171-
assertEquals(parser.getText(), "PojoFoo");
171+
assertEquals("PojoFoo", parser.getText());
172172

173173
assertToken(parser.nextToken(), JsonToken.FIELD_NAME);
174-
assertEquals(parser.currentName(), "collection");
174+
assertEquals("collection", parser.currentName());
175175
assertToken(parser.nextToken(), JsonToken.START_OBJECT);
176176

177177
assertToken(parser.nextToken(), JsonToken.FIELD_NAME);
178-
assertEquals("Should have property with name 'v'", parser.currentName(), "v");
178+
assertEquals("v", parser.currentName(), "Should have property with name 'v'");
179179
assertToken(parser.nextToken(), JsonToken.START_ARRAY);
180180

181181
assertToken(parser.nextToken(), JsonToken.VALUE_STRING);
182-
assertEquals("Should get String value '1'", parser.getText(), "1");
182+
assertEquals("1", parser.getText(), "Should get String value '1'");
183183

184184
assertToken(parser.nextToken(), JsonToken.END_ARRAY);
185185
assertToken(parser.nextToken(), JsonToken.END_OBJECT);

smile/src/test/java/com/fasterxml/jackson/dataformat/smile/gen/dos/CyclicSmileDataSerTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import com.fasterxml.jackson.databind.ObjectMapper;
1111
import com.fasterxml.jackson.dataformat.smile.BaseTestForSmile;
1212

13-
import static org.junit.jupiter.api.Assertions.fail;
13+
import static org.junit.jupiter.api.Assertions.*;
1414

1515
public class CyclicSmileDataSerTest extends BaseTestForSmile
1616
{
@@ -26,8 +26,8 @@ public void testListWithSelfReference() throws Exception {
2626
} catch (DatabindException e) {
2727
String exceptionPrefix = String.format("Document nesting depth (%d) exceeds the maximum allowed",
2828
StreamWriteConstraints.DEFAULT_MAX_DEPTH + 1);
29-
assertTrue("DatabindException message is as expected?",
30-
e.getMessage().startsWith(exceptionPrefix));
29+
assertTrue(e.getMessage().startsWith(exceptionPrefix),
30+
"DatabindException message is as expected?");
3131
}
3232
}
3333
}

smile/src/test/java/com/fasterxml/jackson/dataformat/smile/parse/SmileNumberParsingTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,8 @@ public void testVeryBigDecimal() throws IOException
428428
p.getNumberType();
429429
fail("expected StreamConstraintsException");
430430
} catch (StreamConstraintsException nfe) {
431-
assertTrue("unexpected exception message: " + nfe.getMessage(),
432-
nfe.getMessage().startsWith("Number value length (4153) exceeds the maximum allowed"));
431+
assertTrue(nfe.getMessage().startsWith("Number value length (4153) exceeds the maximum allowed"),
432+
"unexpected exception message: " + nfe.getMessage());
433433
}
434434
}
435435
}

smile/src/test/java/com/fasterxml/jackson/dataformat/smile/parse/dos/DeepNestingSmileParserTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import com.fasterxml.jackson.dataformat.smile.BaseTestForSmile;
1111
import com.fasterxml.jackson.dataformat.smile.SmileFactory;
1212

13-
import static org.junit.jupiter.api.Assertions.fail;
13+
import static org.junit.jupiter.api.Assertions.*;
1414

1515
public class DeepNestingSmileParserTest extends BaseTestForSmile
1616
{
@@ -28,8 +28,8 @@ public void testDeeplyNestedObjects() throws Exception
2828
} catch (StreamConstraintsException e) {
2929
String exceptionPrefix = String.format("Document nesting depth (%d) exceeds the maximum allowed",
3030
StreamReadConstraints.DEFAULT_MAX_DEPTH + 1);
31-
assertTrue("StreamConstraintsException message is as expected?",
32-
e.getMessage().startsWith(exceptionPrefix));
31+
assertTrue(e.getMessage().startsWith(exceptionPrefix),
32+
"StreamConstraintsException message is as expected?");
3333
}
3434
}
3535

@@ -63,8 +63,8 @@ public void testDeeplyNestedArrays() throws Exception
6363
} catch (StreamConstraintsException e) {
6464
String exceptionPrefix = String.format("Document nesting depth (%d) exceeds the maximum allowed",
6565
StreamReadConstraints.DEFAULT_MAX_DEPTH + 1);
66-
assertTrue("StreamConstraintsException message is as expected?",
67-
e.getMessage().startsWith(exceptionPrefix));
66+
assertTrue(e.getMessage().startsWith(exceptionPrefix),
67+
"StreamConstraintsException message is as expected?");
6868
}
6969
}
7070

smile/src/test/java/com/fasterxml/jackson/dataformat/smile/testutil/PrefixInputDecorator.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55

66
import com.fasterxml.jackson.core.io.IOContext;
77
import com.fasterxml.jackson.core.io.InputDecorator;
8-
9-
@SuppressWarnings("serial")
108
import org.junit.jupiter.api.Test;
119
import static org.junit.jupiter.api.Assertions.*;
1210

11+
@SuppressWarnings("serial")
1312
public class PrefixInputDecorator extends InputDecorator
1413
{
1514
protected final byte[] _prefix;

smile/src/test/java/com/fasterxml/jackson/dataformat/smile/testutil/PrefixOutputDecorator.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44

55
import com.fasterxml.jackson.core.io.IOContext;
66
import com.fasterxml.jackson.core.io.OutputDecorator;
7-
8-
@SuppressWarnings("serial")
97
import org.junit.jupiter.api.Test;
108
import static org.junit.jupiter.api.Assertions.*;
119

10+
@SuppressWarnings("serial")
1211
public class PrefixOutputDecorator extends OutputDecorator
1312
{
1413
protected final byte[] _prefix;

smile/src/test/java/perf/MediaItem.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
import java.util.ArrayList;
44
import java.util.List;
55

6-
import Image;
7-
8-
MediaItem
6+
public class MediaItem
97
{
108
public Media media;
119
public List<Image> images;

0 commit comments

Comments
 (0)