Skip to content

Commit ed68f66

Browse files
authored
Now that databind#5032 has merged jackson-datatype-jsr310, need to remove dep from kotlin module (#938)
1 parent 314682c commit ed68f66

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

pom.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,16 @@
119119
<artifactId>jackson-dataformat-xml</artifactId>
120120
<scope>test</scope>
121121
</dependency>
122+
<!-- 06-Apr-2025, tatu: JSR-310 module merged in jackson-databind
123+
for 3.0.0-rc3
124+
-->
125+
<!--
122126
<dependency>
123-
<!-- needed for kotlin.time.Duration converter test -->
124127
<groupId>tools.jackson.datatype</groupId>
125128
<artifactId>jackson-datatype-jsr310</artifactId>
126129
<scope>test</scope>
127130
</dependency>
131+
-->
128132
</dependencies>
129133

130134
<build>

src/test/kotlin/tools/jackson/module/kotlin/test/DurationTests.kt

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import com.fasterxml.jackson.annotation.JsonFormat
55
import com.fasterxml.jackson.annotation.JsonFormat.Shape.STRING
66
import tools.jackson.databind.SerializationFeature
77
import tools.jackson.databind.json.JsonMapper
8-
import tools.jackson.datatype.jsr310.JavaTimeModule
98
import tools.jackson.module.kotlin.KotlinFeature
109
import tools.jackson.module.kotlin.kotlinModule
1110
import tools.jackson.module.kotlin.readValue
@@ -24,7 +23,7 @@ class DurationTests {
2423

2524
@Test
2625
fun `should serialize Kotlin duration using Java time module`() {
27-
val mapper = mapperBuilder.addModule(JavaTimeModule())
26+
val mapper = mapperBuilder
2827
.disable(SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS)
2928
.build()
3029

@@ -35,7 +34,7 @@ class DurationTests {
3534

3635
@Test
3736
fun `should deserialize Kotlin duration`() {
38-
val mapper = mapperBuilder.addModule(JavaTimeModule()).build()
37+
val mapper = mapperBuilder.build()
3938

4039
val result = mapper.readValue<KotlinDuration>("\"PT1H\"")
4140

@@ -44,7 +43,7 @@ class DurationTests {
4443

4544
@Test
4645
fun `should serialize Kotlin duration inside list using Java time module`() {
47-
val mapper = mapperBuilder.addModule(JavaTimeModule())
46+
val mapper = mapperBuilder
4847
.disable(SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS)
4948
.build()
5049

@@ -55,7 +54,7 @@ class DurationTests {
5554

5655
@Test
5756
fun `should deserialize Kotlin duration inside list`() {
58-
val mapper = mapperBuilder.addModule(JavaTimeModule()).build()
57+
val mapper = mapperBuilder.build()
5958

6059
val result = mapper.readValue<List<KotlinDuration>>("""["PT1H","PT2H","PT3H"]""")
6160

@@ -64,7 +63,7 @@ class DurationTests {
6463

6564
@Test
6665
fun `should serialize Kotlin duration inside map using Java time module`() {
67-
val mapper = mapperBuilder.addModule(JavaTimeModule())
66+
val mapper = mapperBuilder
6867
.disable(SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS)
6968
.build()
7069

@@ -81,7 +80,7 @@ class DurationTests {
8180

8281
@Test
8382
fun `should deserialize Kotlin duration inside map`() {
84-
val mapper = mapperBuilder.addModule(JavaTimeModule()).build()
83+
val mapper = mapperBuilder.build()
8584

8685
val result = mapper.readValue<Map<String, KotlinDuration>>("""{"a":"PT1H","b":"PT2H","c":"PT3H"}""")
8786

@@ -109,7 +108,7 @@ class DurationTests {
109108

110109
@Test
111110
fun `should serialize Kotlin duration inside data class using Java time module`() {
112-
val mapper = mapperBuilder.addModule(JavaTimeModule())
111+
val mapper = mapperBuilder
113112
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
114113
.disable(SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS)
115114
.build()
@@ -121,7 +120,7 @@ class DurationTests {
121120

122121
@Test
123122
fun `should deserialize Kotlin duration inside data class`() {
124-
val mapper = mapperBuilder.addModule(JavaTimeModule()).build()
123+
val mapper = mapperBuilder.build()
125124

126125
val result = mapper.readValue<Meeting>("""{"start":"2023-06-20T14:00:00Z","duration":"PT1H30M"}""")
127126

@@ -131,7 +130,7 @@ class DurationTests {
131130

132131
@Test
133132
fun `should deserialize Kotlin duration inside data class using mixin`() {
134-
val mapper = mapperBuilder.addModule(JavaTimeModule())
133+
val mapper = mapperBuilder
135134
.addMixIn(Meeting::class.java, MeetingMixin::class.java)
136135
.build()
137136

@@ -143,7 +142,7 @@ class DurationTests {
143142

144143
@Test
145144
fun `should serialize Kotlin duration inside data class using Java time module and mixin`() {
146-
val mapper = mapperBuilder.addModule(JavaTimeModule())
145+
val mapper = mapperBuilder
147146
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
148147
.addMixIn(Meeting::class.java, MeetingMixin::class.java)
149148
.build()
@@ -173,7 +172,7 @@ class DurationTests {
173172

174173
@Test
175174
fun `should serialize Kotlin duration exactly as Java duration`() {
176-
val mapper = mapperBuilder.addModule(JavaTimeModule()).build()
175+
val mapper = mapperBuilder.build()
177176

178177
val jdto = JDTO()
179178
val kdto = KDTO()
@@ -198,7 +197,7 @@ class DurationTests {
198197

199198
@Test
200199
fun `should deserialize using custom units specified by format annotation`() {
201-
val mapper = mapperBuilder.addModule(JavaTimeModule()).build()
200+
val mapper = mapperBuilder.build()
202201

203202
val actual = mapper.readValue<DurationWithFormattedUnits>("""{"formatted":1,"default":1}""")
204203

0 commit comments

Comments
 (0)