Skip to content

Commit 403ff4f

Browse files
committed
Added jackson-datatype-jsr310 to build.gradle and configured ObjectMappers to use JavaTimeModule for ISO dates.
1 parent 198d073 commit 403ff4f

File tree

2 files changed

+35
-6
lines changed

2 files changed

+35
-6
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ dependencies {
3333
compile("org.jetbrains.kotlin:kotlin-stdlib-jre8:${kotlinVersion}")
3434
compile("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
3535
compile("com.fasterxml.jackson.module:jackson-module-kotlin:2.8.8")
36+
compile("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.8.8")
3637
testCompile("org.junit.jupiter:junit-jupiter-api:5.0.0-M4")
3738
}
3839

src/test/kotlin/org/ga4gh/vmckotlin/ModelTest.kt

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.ga4gh.vmckotlin
22

3+
import com.fasterxml.jackson.databind.SerializationFeature
4+
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
35
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
46
import org.junit.jupiter.api.Assertions.*
57
import org.junit.jupiter.api.Disabled
@@ -12,7 +14,13 @@ import java.time.OffsetDateTime
1214
internal class ModelTest {
1315

1416
val mapper = jacksonObjectMapper()
15-
val prettyMapper = jacksonObjectMapper().writerWithDefaultPrettyPrinter()
17+
.registerModule(JavaTimeModule())
18+
.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
19+
20+
val prettyMapper = jacksonObjectMapper()
21+
.registerModule(JavaTimeModule())
22+
.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
23+
.writerWithDefaultPrettyPrinter()
1624

1725
/**
1826
* In a real working code situation this will be doing a lookup against the biocommons.seqrepo
@@ -42,6 +50,31 @@ internal class ModelTest {
4250

4351
val meta = Meta(OffsetDateTime.parse("2017-06-07T06:13:59.38Z"), "0")
4452

53+
@Test
54+
fun testIdentifier() {
55+
println(chr19GRCh38Identifier.getId())
56+
57+
58+
59+
// "VMC:GL_9Jht-lguk_jnBvG-wLJbjmBw5v_v7rQo": [
60+
// {
61+
// "accession": "rs429358"
62+
// }
63+
// ],
64+
// "VMC:GL_LStELzYmlIQP3Zan9FhibgiFGAgSM7CI": [
65+
// {
66+
// "accession": "rs7412"
67+
// }
68+
// ],
69+
// "VMC:GS_IIB53T8CNeJJdUqzn9V_JnRtQadwWCbl": [
70+
// {
71+
// "accession": "NC_000019.10",
72+
// "namespace": "NCBI"
73+
// }
74+
// ]
75+
76+
}
77+
4578
@Test
4679
fun testInterval() {
4780
assertEquals("<Interval:44908683:44908684>", rs429358Interval.toVmc())
@@ -118,10 +151,5 @@ internal class ModelTest {
118151
)
119152
println(prettyMapper.writeValueAsString(vmcBundle))
120153
}
121-
// "VMC:GS_IIB53T8CNeJJdUqzn9V_JnRtQadwWCbl": [
122-
// {
123-
// "accession": "NC_000019.10",
124-
// "namespace": "NCBI"
125-
// }
126154

127155
}

0 commit comments

Comments
 (0)