@@ -33,24 +33,28 @@ class JacksonInjectTest {
3333
3434 @Test
3535 fun test () {
36- val injectables = InjectableValues .Std (
37- mapOf (
38- " pNn" to Primitive (0 ),
39- " pN" to Primitive (1 ),
40- " nnoNn" to NonNullObject (" nnoNn" ),
41- " nnoN" to NonNullObject (" nnoN" ),
42- " noNnNn" to NullableObject (" noNnNn" ),
43- " noNnN" to NullableObject (null ),
44- " noNNn" to NullableObject (" noNNn" ),
45- " noNN" to NullableObject (null )
46- )
36+ val injectables = mapOf (
37+ " pNn" to Primitive (0 ),
38+ " pN" to Primitive (1 ),
39+ " nnoNn" to NonNullObject (" nnoNn" ),
40+ " nnoN" to NonNullObject (" nnoN" ),
41+ " noNnNn" to NullableObject (" noNnNn" ),
42+ " noNnN" to NullableObject (null ),
43+ " noNNn" to NullableObject (" noNNn" ),
44+ " noNN" to NullableObject (null )
4745 )
4846
4947 val reader = jacksonObjectMapper()
5048 .readerFor(Dto ::class .java)
51- .with (injectables)
49+ .with (InjectableValues .Std (injectables))
50+
51+ val result = reader.readValue<Dto >(" {}" )
52+ val expected = ::Dto .let { ctor ->
53+ val args = ctor.parameters.associateWith { injectables[it.name] }
54+ ctor.callBy(args)
55+ }
5256
53- println (reader.readValue< Dto >( " {} " ) )
57+ assertEquals(expected, result )
5458 }
5559
5660 data class DataBind4218FailingDto (
0 commit comments