Skip to content

Commit 78f208d

Browse files
committed
Fix and migrate remaining ion tests to JUnit 5
1 parent f02d5b5 commit 78f208d

File tree

5 files changed

+102
-93
lines changed

5 files changed

+102
-93
lines changed

ion/src/test/java/com/fasterxml/jackson/dataformat/ion/jsr310/IonTimestampInstantSerializerTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public void testSerializationAsTimestamp01Nanoseconds() throws Exception {
2929

3030
Instant date = Instant.ofEpochSecond(0L);
3131
String value = mapper.writeValueAsString(date);
32-
assertNotNull("The value should not be null.", value);
33-
assertEquals("The value is not correct.", "0.", value);
32+
assertNotNull(value, "The value should not be null.");
33+
assertEquals("0.", value, "The value is not correct.");
3434
}
3535

3636
@Test
@@ -42,7 +42,7 @@ public void testSerializationAsTimestamp01Milliseconds() throws Exception {
4242

4343
Instant date = Instant.ofEpochSecond(0L);
4444
String value = mapper.writeValueAsString(date);
45-
assertEquals("The value is not correct.", "0", value);
45+
assertEquals("0", value, "The value is not correct.");
4646
}
4747

4848
@Test
@@ -54,7 +54,7 @@ public void testSerializationAsTimestamp02Nanoseconds() throws Exception {
5454

5555
Instant date = Instant.ofEpochSecond(123456789L, 183917322);
5656
String value = mapper.writeValueAsString(date);
57-
assertEquals("The value is not correct.", "123456789.183917322", value);
57+
assertEquals("123456789.183917322", value, "The value is not correct.");
5858
}
5959

6060
@Test
@@ -66,7 +66,7 @@ public void testSerializationAsTimestamp02Milliseconds() throws Exception {
6666

6767
Instant date = Instant.ofEpochSecond(123456789L, 183917322);
6868
String value = mapper.writeValueAsString(date);
69-
assertEquals("The value is not correct.", "123456789183", value);
69+
assertEquals("123456789183", value, "The value is not correct.");
7070
}
7171

7272
@Test
@@ -79,7 +79,7 @@ public void testSerializationAsTimestamp03Nanoseconds() throws Exception {
7979
Instant date = Instant.now();
8080
String value = mapper.writeValueAsString(date);
8181
//TODO
82-
assertEquals("The value is not correct.", TimestampUtils.getFractionalSeconds(date).toString(), value);
82+
assertEquals(TimestampUtils.getFractionalSeconds(date).toString(), value, "The value is not correct.");
8383
}
8484

8585
@Test
@@ -91,7 +91,7 @@ public void testSerializationAsTimestamp03Milliseconds() throws Exception {
9191

9292
Instant date = Instant.now();
9393
String value = mapper.writeValueAsString(date);
94-
assertEquals("The value is not correct.", Long.toString(date.toEpochMilli()), value);
94+
assertEquals(Long.toString(date.toEpochMilli()), value, "The value is not correct.");
9595
}
9696

9797
@Test
@@ -139,7 +139,7 @@ public void testSerializationWithTypeInfo01() throws Exception {
139139
IonDecimal value = (IonDecimal) mapper.writeValueAsIonValue(date);
140140
assertEquals(new BigDecimal("123456789.183917322"), value.bigDecimalValue(), "The value is not correct.");
141141
assertEquals(1, value.getTypeAnnotations().length, "The does does not contain the expected number of annotations.");
142-
assertEquals("The does does not contain the expected annotation.", Instant.class.getName(), value.getTypeAnnotations()[0]);
142+
assertEquals(Instant.class.getName(), value.getTypeAnnotations()[0], "The does does not contain the expected annotation.");
143143
}
144144

145145
@Test
@@ -154,7 +154,7 @@ public void testSerializationWithTypeInfo02() throws Exception {
154154
IonInt value = (IonInt) mapper.writeValueAsIonValue(date);
155155
assertEquals(123456789183L, value.longValue(), "The value is not correct.");
156156
assertEquals(1, value.getTypeAnnotations().length, "The does does not contain the expected number of annotations.");
157-
assertEquals("The does does not contain the expected annotation.", Instant.class.getName(), value.getTypeAnnotations()[0]);
157+
assertEquals(Instant.class.getName(), value.getTypeAnnotations()[0], "The does does not contain the expected annotation.");
158158
}
159159

160160
@Test
@@ -168,6 +168,6 @@ public void testSerializationWithTypeInfo03() throws Exception {
168168
IonTimestamp value = (IonTimestamp) mapper.writeValueAsIonValue(date);
169169
assertEquals(TimestampUtils.toTimestamp(date, ZoneOffset.UTC), value.timestampValue(), "The value is not correct.");
170170
assertEquals(1, value.getTypeAnnotations().length, "The does does not contain the expected number of annotations.");
171-
assertEquals("The does does not contain the expected annotation.", Instant.class.getName(), value.getTypeAnnotations()[0]);
171+
assertEquals(Instant.class.getName(), value.getTypeAnnotations()[0], "The does does not contain the expected annotation.");
172172
}
173173
}

ion/src/test/java/com/fasterxml/jackson/dataformat/ion/jsr310/IonTimestampOffsetDateTimeSerializerTest.java

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void testSerializationAsTimestamp01Nanoseconds() throws Exception {
3131

3232
OffsetDateTime date = OffsetDateTime.ofInstant(Instant.ofEpochSecond(0L), Z1);
3333
String value = mapper.writeValueAsString(date);
34-
assertEquals("The value is not correct.", "0.", value);
34+
assertEquals("0.", value, "The value is not correct.");
3535
}
3636

3737
@Test
@@ -43,7 +43,7 @@ public void testSerializationAsTimestamp01Milliseconds() throws Exception {
4343

4444
OffsetDateTime date = OffsetDateTime.ofInstant(Instant.ofEpochSecond(0L), Z1);
4545
String value = mapper.writeValueAsString(date);
46-
assertEquals("The value is not correct.", "0", value);
46+
assertEquals("0", value, "The value is not correct.");
4747
}
4848

4949
@Test
@@ -55,7 +55,7 @@ public void testSerializationAsTimestamp02Nanoseconds() throws Exception {
5555

5656
OffsetDateTime date = OffsetDateTime.ofInstant(Instant.ofEpochSecond(123456789L, 183917322), Z2);
5757
String value = mapper.writeValueAsString(date);
58-
assertEquals("The value is not correct.", "123456789.183917322", value);
58+
assertEquals("123456789.183917322", value, "The value is not correct.");
5959
}
6060

6161
@Test
@@ -67,7 +67,7 @@ public void testSerializationAsTimestamp02Milliseconds() throws Exception {
6767

6868
OffsetDateTime date = OffsetDateTime.ofInstant(Instant.ofEpochSecond(123456789L, 183917322), Z2);
6969
String value = mapper.writeValueAsString(date);
70-
assertEquals("The value is not correct.", "123456789183", value);
70+
assertEquals("123456789183", value, "The value is not correct.");
7171
}
7272

7373
@Test
@@ -79,7 +79,7 @@ public void testSerializationAsTimestamp03Nanoseconds() throws Exception {
7979

8080
OffsetDateTime date = OffsetDateTime.now(Z3);
8181
String value = mapper.writeValueAsString(date);
82-
assertEquals("The value is not correct.", TimestampUtils.getFractionalSeconds(date.toInstant()).toString(), value);
82+
assertEquals(TimestampUtils.getFractionalSeconds(date.toInstant()).toString(), value, "The value is not correct.");
8383
}
8484

8585
@Test
@@ -91,7 +91,7 @@ public void testSerializationAsTimestamp03Milliseconds() throws Exception {
9191

9292
OffsetDateTime date = OffsetDateTime.now(Z3);
9393
String value = mapper.writeValueAsString(date);
94-
assertEquals("The value is not correct.", Long.toString(date.toInstant().toEpochMilli()), value);
94+
assertEquals(Long.toString(date.toInstant().toEpochMilli()), value, "The value is not correct.");
9595
}
9696

9797
@Test
@@ -102,8 +102,8 @@ public void testSerializationAsString01() throws Exception {
102102
.build();
103103

104104
String value = mapper.writeValueAsString(date);
105-
assertEquals("The value is not correct.",
106-
TimestampUtils.toTimestamp(date.toInstant(), date.getOffset()).toString(), value);
105+
assertEquals(TimestampUtils.toTimestamp(date.toInstant(), date.getOffset()).toString(), value,
106+
"The value is not correct.");
107107
}
108108

109109
@Test
@@ -114,8 +114,8 @@ public void testSerializationAsString02() throws Exception {
114114
.build();
115115

116116
String value = mapper.writeValueAsString(date);
117-
assertEquals("The value is not correct.",
118-
TimestampUtils.toTimestamp(date.toInstant(), date.getOffset()).toString(), value);
117+
assertEquals(TimestampUtils.toTimestamp(date.toInstant(), date.getOffset()).toString(), value,
118+
"The value is not correct.");
119119
}
120120

121121
@Test
@@ -126,8 +126,8 @@ public void testSerializationAsString03() throws Exception {
126126
.build();
127127

128128
String value = mapper.writeValueAsString(date);
129-
assertEquals("The value is not correct.",
130-
TimestampUtils.toTimestamp(date.toInstant(), date.getOffset()).toString(), value);
129+
assertEquals(TimestampUtils.toTimestamp(date.toInstant(), date.getOffset()).toString(), value,
130+
"The value is not correct.");
131131
}
132132

133133
@Test
@@ -140,8 +140,8 @@ public void testSerializationWithTypeInfo01() throws Exception {
140140
.build();
141141

142142
String value = mapper.writeValueAsString(date);
143-
assertEquals("The value is not correct.",
144-
"'" + OffsetDateTime.class.getName() + "'::123456789.183917322", value);
143+
assertEquals("'" + OffsetDateTime.class.getName() + "'::123456789.183917322", value,
144+
"The value is not correct.");
145145
}
146146

147147
@Test
@@ -154,8 +154,8 @@ public void testSerializationWithTypeInfo02() throws Exception {
154154
.build();
155155

156156
String value = mapper.writeValueAsString(date);
157-
assertEquals("The value is not correct.",
158-
"'" + OffsetDateTime.class.getName() + "'::123456789183", value);
157+
assertEquals("'" + OffsetDateTime.class.getName() + "'::123456789183", value,
158+
"The value is not correct.");
159159
}
160160

161161
@Test
@@ -167,8 +167,9 @@ public void testSerializationWithTypeInfo03() throws Exception {
167167
.build();
168168

169169
String value = mapper.writeValueAsString(date);
170-
assertNotNull("The value should not be null.", value);
171-
assertEquals("The value is not correct.","'" + OffsetDateTime.class.getName() + "'::"
172-
+ TimestampUtils.toTimestamp(date.toInstant(), date.getOffset()).toString(), value);
170+
assertNotNull(value, "The value should not be null.");
171+
assertEquals("'" + OffsetDateTime.class.getName() + "'::"
172+
+ TimestampUtils.toTimestamp(date.toInstant(), date.getOffset()).toString(), value,
173+
"The value is not correct.");
173174
}
174175
}

0 commit comments

Comments
 (0)