Skip to content

Commit 9be0398

Browse files
committed
Fix unit test fails
1 parent a3a6e27 commit 9be0398

File tree

6 files changed

+69
-69
lines changed

6 files changed

+69
-69
lines changed

cbor/src/test/java/tools/jackson/dataformat/cbor/GeneratorDupHandlingTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import tools.jackson.core.*;
99
import tools.jackson.core.exc.StreamWriteException;
1010

11-
import static org.junit.jupiter.api.Assertions.assertFalse;
1211
import static org.junit.jupiter.api.Assertions.fail;
1312

1413
public class GeneratorDupHandlingTest extends CBORTestBase

ion/src/main/java/tools/jackson/dataformat/ion/IonTimestampSerializers.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import tools.jackson.core.JsonGenerator;
2121

22-
import tools.jackson.databind.SerializationFeature;
22+
import tools.jackson.databind.cfg.DateTimeFeature;
2323
import tools.jackson.databind.SerializationContext;
2424
import tools.jackson.databind.ser.std.StdScalarSerializer;
2525

@@ -38,7 +38,7 @@ public IonTimestampJavaDateSerializer() {
3838
public void serialize(java.util.Date date, JsonGenerator jsonGenerator, SerializationContext ctxt)
3939
{
4040
// Still respect writing dates as millis if desired
41-
if (ctxt.isEnabled(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)) {
41+
if (ctxt.isEnabled(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)) {
4242
jsonGenerator.writeNumber(date.getTime());
4343
} else {
4444
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
@@ -58,7 +58,7 @@ public IonTimestampSQLDateSerializer() {
5858
public void serialize(java.sql.Date date, JsonGenerator jsonGenerator, SerializationContext ctxt)
5959
{
6060
// Still respect writing dates as millis if desired
61-
if (ctxt.isEnabled(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)) {
61+
if (ctxt.isEnabled(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)) {
6262
jsonGenerator.writeNumber(date.getTime());
6363
} else {
6464
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));

ion/src/main/java/tools/jackson/dataformat/ion/jsr310/IonTimestampInstantSerializer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import tools.jackson.core.JsonGenerator;
1313

1414
import tools.jackson.databind.*;
15+
import tools.jackson.databind.cfg.DateTimeFeature;
1516
import tools.jackson.databind.ser.std.StdScalarSerializer;
1617
import tools.jackson.dataformat.ion.IonGenerator;
1718

@@ -88,7 +89,7 @@ public void serialize(T value, JsonGenerator gen, SerializationContext provider)
8889
throws JacksonException
8990
{
9091
final Instant instant = getInstant.apply(value);
91-
if (provider.isEnabled(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)) {
92+
if (provider.isEnabled(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)) {
9293
if (shouldWriteTimestampsAsNanos(provider)) {
9394
gen.writeNumber(TimestampUtils.getFractionalSeconds(instant));
9495
} else {
@@ -116,7 +117,7 @@ private boolean shouldWriteTimestampsAsNanos(SerializationContext provider) {
116117
if (Boolean.FALSE.equals(writeDateTimestampsAsNanosOverride)) {
117118
return false;
118119
}
119-
return provider.isEnabled(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
120+
return provider.isEnabled(DateTimeFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
120121
|| Boolean.TRUE.equals(writeDateTimestampsAsNanosOverride);
121122
}
122123

ion/src/test/java/tools/jackson/dataformat/ion/jsr310/IonTimestampInstantSerializerTest.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import com.amazon.ion.*;
88
import org.junit.jupiter.api.Test;
99

10-
import tools.jackson.databind.SerializationFeature;
10+
import tools.jackson.databind.cfg.DateTimeFeature;
1111
import tools.jackson.dataformat.ion.IonObjectMapper;
1212

1313
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -23,8 +23,8 @@ private IonObjectMapper.Builder newMapperBuilder() {
2323
@Test
2424
public void testSerializationAsTimestamp01Nanoseconds() throws Exception {
2525
IonObjectMapper mapper = newMapperBuilder()
26-
.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
27-
.enable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
26+
.enable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
27+
.enable(DateTimeFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
2828
.build();
2929

3030
Instant date = Instant.ofEpochSecond(0L);
@@ -36,8 +36,8 @@ public void testSerializationAsTimestamp01Nanoseconds() throws Exception {
3636
@Test
3737
public void testSerializationAsTimestamp01Milliseconds() throws Exception {
3838
IonObjectMapper mapper = newMapperBuilder()
39-
.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
40-
.disable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
39+
.enable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
40+
.disable(DateTimeFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
4141
.build();
4242

4343
Instant date = Instant.ofEpochSecond(0L);
@@ -48,8 +48,8 @@ public void testSerializationAsTimestamp01Milliseconds() throws Exception {
4848
@Test
4949
public void testSerializationAsTimestamp02Nanoseconds() throws Exception {
5050
IonObjectMapper mapper = newMapperBuilder()
51-
.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
52-
.enable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
51+
.enable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
52+
.enable(DateTimeFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
5353
.build();
5454

5555
Instant date = Instant.ofEpochSecond(123456789L, 183917322);
@@ -60,8 +60,8 @@ public void testSerializationAsTimestamp02Nanoseconds() throws Exception {
6060
@Test
6161
public void testSerializationAsTimestamp02Milliseconds() throws Exception {
6262
IonObjectMapper mapper = newMapperBuilder()
63-
.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
64-
.disable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
63+
.enable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
64+
.disable(DateTimeFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
6565
.build();
6666

6767
Instant date = Instant.ofEpochSecond(123456789L, 183917322);
@@ -72,8 +72,8 @@ public void testSerializationAsTimestamp02Milliseconds() throws Exception {
7272
@Test
7373
public void testSerializationAsTimestamp03Nanoseconds() throws Exception {
7474
IonObjectMapper mapper = newMapperBuilder()
75-
.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
76-
.enable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
75+
.enable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
76+
.enable(DateTimeFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
7777
.build();
7878

7979
Instant date = Instant.now();
@@ -85,8 +85,8 @@ public void testSerializationAsTimestamp03Nanoseconds() throws Exception {
8585
@Test
8686
public void testSerializationAsTimestamp03Milliseconds() throws Exception {
8787
IonObjectMapper mapper = newMapperBuilder()
88-
.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
89-
.disable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
88+
.enable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
89+
.disable(DateTimeFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
9090
.build();
9191

9292
Instant date = Instant.now();
@@ -97,7 +97,7 @@ public void testSerializationAsTimestamp03Milliseconds() throws Exception {
9797
@Test
9898
public void testSerializationAsString01() throws Exception {
9999
IonObjectMapper mapper = newMapperBuilder()
100-
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
100+
.disable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
101101
.build();
102102

103103
Instant date = Instant.ofEpochSecond(0L);
@@ -108,7 +108,7 @@ public void testSerializationAsString01() throws Exception {
108108
@Test
109109
public void testSerializationAsString02() throws Exception {
110110
IonObjectMapper mapper = newMapperBuilder()
111-
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
111+
.disable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
112112
.build();
113113

114114
Instant date = Instant.ofEpochSecond(123456789L, 183917322);
@@ -119,7 +119,7 @@ public void testSerializationAsString02() throws Exception {
119119
@Test
120120
public void testSerializationAsString03() throws Exception {
121121
IonObjectMapper mapper = newMapperBuilder()
122-
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
122+
.disable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
123123
.build();
124124

125125
Instant date = Instant.now();
@@ -130,8 +130,8 @@ public void testSerializationAsString03() throws Exception {
130130
@Test
131131
public void testSerializationWithTypeInfo01() throws Exception {
132132
IonObjectMapper mapper = newMapperBuilder()
133-
.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
134-
.enable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
133+
.enable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
134+
.enable(DateTimeFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
135135
.addMixIn(Instant.class, MockObjectConfiguration.class)
136136
.build();
137137

@@ -145,8 +145,8 @@ public void testSerializationWithTypeInfo01() throws Exception {
145145
@Test
146146
public void testSerializationWithTypeInfo02() throws Exception {
147147
IonObjectMapper mapper = newMapperBuilder()
148-
.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
149-
.disable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
148+
.enable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
149+
.disable(DateTimeFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
150150
.addMixIn(Instant.class, MockObjectConfiguration.class)
151151
.build();
152152

@@ -160,7 +160,7 @@ public void testSerializationWithTypeInfo02() throws Exception {
160160
@Test
161161
public void testSerializationWithTypeInfo03() throws Exception {
162162
IonObjectMapper mapper = newMapperBuilder()
163-
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
163+
.disable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
164164
.addMixIn(Instant.class, MockObjectConfiguration.class)
165165
.build();
166166

ion/src/test/java/tools/jackson/dataformat/ion/jsr310/IonTimestampOffsetDateTimeSerializerTest.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import org.junit.jupiter.api.Test;
77

8-
import tools.jackson.databind.SerializationFeature;
8+
import tools.jackson.databind.cfg.DateTimeFeature;
99
import tools.jackson.dataformat.ion.IonObjectMapper;
1010

1111
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -25,8 +25,8 @@ private IonObjectMapper.Builder newMapperBuilder() {
2525
@Test
2626
public void testSerializationAsTimestamp01Nanoseconds() throws Exception {
2727
IonObjectMapper mapper = newMapperBuilder()
28-
.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
29-
.enable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
28+
.enable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
29+
.enable(DateTimeFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
3030
.build();
3131

3232
OffsetDateTime date = OffsetDateTime.ofInstant(Instant.ofEpochSecond(0L), Z1);
@@ -37,8 +37,8 @@ public void testSerializationAsTimestamp01Nanoseconds() throws Exception {
3737
@Test
3838
public void testSerializationAsTimestamp01Milliseconds() throws Exception {
3939
IonObjectMapper mapper = newMapperBuilder()
40-
.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
41-
.disable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
40+
.enable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
41+
.disable(DateTimeFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
4242
.build();
4343

4444
OffsetDateTime date = OffsetDateTime.ofInstant(Instant.ofEpochSecond(0L), Z1);
@@ -49,8 +49,8 @@ public void testSerializationAsTimestamp01Milliseconds() throws Exception {
4949
@Test
5050
public void testSerializationAsTimestamp02Nanoseconds() throws Exception {
5151
IonObjectMapper mapper = newMapperBuilder()
52-
.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
53-
.enable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
52+
.enable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
53+
.enable(DateTimeFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
5454
.build();
5555

5656
OffsetDateTime date = OffsetDateTime.ofInstant(Instant.ofEpochSecond(123456789L, 183917322), Z2);
@@ -61,8 +61,8 @@ public void testSerializationAsTimestamp02Nanoseconds() throws Exception {
6161
@Test
6262
public void testSerializationAsTimestamp02Milliseconds() throws Exception {
6363
IonObjectMapper mapper = newMapperBuilder()
64-
.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
65-
.disable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
64+
.enable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
65+
.disable(DateTimeFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
6666
.build();
6767

6868
OffsetDateTime date = OffsetDateTime.ofInstant(Instant.ofEpochSecond(123456789L, 183917322), Z2);
@@ -73,8 +73,8 @@ public void testSerializationAsTimestamp02Milliseconds() throws Exception {
7373
@Test
7474
public void testSerializationAsTimestamp03Nanoseconds() throws Exception {
7575
IonObjectMapper mapper = newMapperBuilder()
76-
.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
77-
.enable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
76+
.enable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
77+
.enable(DateTimeFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
7878
.build();
7979

8080
OffsetDateTime date = OffsetDateTime.now(Z3);
@@ -85,8 +85,8 @@ public void testSerializationAsTimestamp03Nanoseconds() throws Exception {
8585
@Test
8686
public void testSerializationAsTimestamp03Milliseconds() throws Exception {
8787
IonObjectMapper mapper = newMapperBuilder()
88-
.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
89-
.disable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
88+
.enable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
89+
.disable(DateTimeFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
9090
.build();
9191

9292
OffsetDateTime date = OffsetDateTime.now(Z3);
@@ -98,7 +98,7 @@ public void testSerializationAsTimestamp03Milliseconds() throws Exception {
9898
public void testSerializationAsString01() throws Exception {
9999
OffsetDateTime date = OffsetDateTime.ofInstant(Instant.ofEpochSecond(0L), Z1);
100100
IonObjectMapper mapper = newMapperBuilder()
101-
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
101+
.disable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
102102
.build();
103103

104104
String value = mapper.writeValueAsString(date);
@@ -110,7 +110,7 @@ public void testSerializationAsString01() throws Exception {
110110
public void testSerializationAsString02() throws Exception {
111111
OffsetDateTime date = OffsetDateTime.ofInstant(Instant.ofEpochSecond(123456789L, 183917322), Z2);
112112
IonObjectMapper mapper = newMapperBuilder()
113-
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
113+
.disable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
114114
.build();
115115

116116
String value = mapper.writeValueAsString(date);
@@ -122,7 +122,7 @@ public void testSerializationAsString02() throws Exception {
122122
public void testSerializationAsString03() throws Exception {
123123
OffsetDateTime date = OffsetDateTime.now(Z3);
124124
IonObjectMapper mapper = newMapperBuilder()
125-
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
125+
.disable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
126126
.build();
127127

128128
String value = mapper.writeValueAsString(date);
@@ -135,8 +135,8 @@ public void testSerializationWithTypeInfo01() throws Exception {
135135
OffsetDateTime date = OffsetDateTime.ofInstant(Instant.ofEpochSecond(123456789L, 183917322), Z2);
136136
IonObjectMapper mapper = newMapperBuilder()
137137
.addMixIn(Temporal.class, MockObjectConfiguration.class)
138-
.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
139-
.enable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
138+
.enable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
139+
.enable(DateTimeFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
140140
.build();
141141

142142
String value = mapper.writeValueAsString(date);
@@ -149,8 +149,8 @@ public void testSerializationWithTypeInfo02() throws Exception {
149149
OffsetDateTime date = OffsetDateTime.ofInstant(Instant.ofEpochSecond(123456789L, 183917322), Z2);
150150
IonObjectMapper mapper = newMapperBuilder()
151151
.addMixIn(Temporal.class, MockObjectConfiguration.class)
152-
.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
153-
.disable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
152+
.enable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
153+
.disable(DateTimeFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
154154
.build();
155155

156156
String value = mapper.writeValueAsString(date);
@@ -163,7 +163,7 @@ public void testSerializationWithTypeInfo03() throws Exception {
163163
OffsetDateTime date = OffsetDateTime.now(Z3);
164164
IonObjectMapper mapper = newMapperBuilder()
165165
.addMixIn(Temporal.class, MockObjectConfiguration.class)
166-
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
166+
.disable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
167167
.build();
168168

169169
String value = mapper.writeValueAsString(date);

0 commit comments

Comments
 (0)