ursus
01/18/2025, 11:45 PMList
working with restTemplate.getForObject<List<X>>
kotlin extension? I'm getting class cast exceptionsDaniel Pitts
01/19/2025, 8:03 PMList
?ursus
01/19/2025, 9:55 PMDaniel Pitts
01/19/2025, 9:57 PMursus
01/19/2025, 10:05 PMclass java.util.LinkedHashMap cannot be cast to class com.example.demo.Person (java.util.LinkedHashMap is in module java.base of loader 'bootstrap'; com.example.demo.Person is in unnamed module of loader 'app')
java.lang.ClassCastException: class java.util.LinkedHashMap cannot be cast to class com.example.demo.Person (java.util.LinkedHashMap is in module java.base of loader 'bootstrap'; com.example.demo.Person is in unnamed module of loader 'app')
at com.example.demo.PersonControllerTests.when POST person is called, bla bla(PersonControllerTests.kt:48)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:767)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
....
```val response = client.getForObject<List<Person>>("/people")
val firstPerson = response?.first()
ursus
01/19/2025, 10:07 PMList<Person>
Daniel Pitts
01/19/2025, 10:42 PMursus
01/19/2025, 10:43 PM