@@ -5,7 +5,6 @@ import com.fasterxml.jackson.annotation.JsonFormat
55import com.fasterxml.jackson.annotation.JsonFormat.Shape.STRING
66import tools.jackson.databind.SerializationFeature
77import tools.jackson.databind.json.JsonMapper
8- import tools.jackson.datatype.jsr310.JavaTimeModule
98import tools.jackson.module.kotlin.KotlinFeature
109import tools.jackson.module.kotlin.kotlinModule
1110import 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