Skip to content

Commit dbe31ab

Browse files
committed
Refactor test
1 parent 8eb6443 commit dbe31ab

File tree

1 file changed

+8
-6
lines changed
  • src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github

1 file changed

+8
-6
lines changed

src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/Github101.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ import kotlin.test.assertEquals
1010
class TestGithub101_JacksonInjectTest {
1111
@Test
1212
fun `JacksonInject-annotated parameters are populated when constructing Kotlin data classes`() {
13-
val mapper = jacksonObjectMapper()
1413
val contextualValue = UUID.randomUUID()
15-
assertEquals(SomeDatum("test", contextualValue),
16-
mapper.readerFor(SomeDatum::class.java)
17-
.with(InjectableValues.Std(mapOf("context" to contextualValue)))
18-
.readValue("""{ "value": "test" }"""))
14+
val reader = jacksonObjectMapper()
15+
.readerFor(SomeDatum::class.java)
16+
.with(InjectableValues.Std(mapOf("context" to contextualValue)))
17+
assertEquals(
18+
SomeDatum("test", contextualValue),
19+
reader.readValue("""{ "value": "test" }""")
20+
)
1921
}
2022

2123
data class SomeDatum(val value: String, @JacksonInject("context") val contextualValue: UUID)
22-
}
24+
}

0 commit comments

Comments
 (0)