Improve Kotlin extensions doc about type erasure
Since type erasure can be fixed only when using ParameterizedTypeReference based Java methods, TestRestTemplate API documentation should be updated to specify which extensions are subject to type erasure, and which are not. Closes gh-11604
This commit is contained in:
committed by
Stephane Nicoll
parent
b7a993358d
commit
d4c91d2fe0
@@ -122,6 +122,13 @@ class TestRestTemplateExtensionsTests {
|
||||
verify(template, times(1)).patchForObject(url, body, Foo::class.java)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `patchForObject with reified type parameters`() {
|
||||
val url = "https://spring.io"
|
||||
template.patchForObject<Foo>(url)
|
||||
verify(template, times(1)).patchForObject(url, null, Foo::class.java)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `postForObject with reified type parameters, String, Any and varargs`() {
|
||||
val url = "https://spring.io"
|
||||
@@ -149,6 +156,13 @@ class TestRestTemplateExtensionsTests {
|
||||
verify(template, times(1)).postForObject(url, body, Foo::class.java)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `postForObject with reified type parameters`() {
|
||||
val url = "https://spring.io"
|
||||
template.postForObject<Foo>(url)
|
||||
verify(template, times(1)).postForObject(url, null, Foo::class.java)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `postForEntity with reified type parameters, String, Any and varargs`() {
|
||||
val url = "https://spring.io"
|
||||
@@ -176,6 +190,13 @@ class TestRestTemplateExtensionsTests {
|
||||
verify(template, times(1)).postForEntity(url, body, Foo::class.java)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `postForEntity with reified type parameters`() {
|
||||
val url = "https://spring.io"
|
||||
template.postForEntity<Foo>(url)
|
||||
verify(template, times(1)).postForEntity(url, null, Foo::class.java)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `exchange with reified type parameters, String, HttpMethod, HttpEntity and varargs`() {
|
||||
val url = "https://spring.io"
|
||||
@@ -217,6 +238,15 @@ class TestRestTemplateExtensionsTests {
|
||||
object : ParameterizedTypeReference<List<Foo>>() {})
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `exchange with reified type parameters, String and HttpMethod`() {
|
||||
val url = "https://spring.io"
|
||||
val method = HttpMethod.GET
|
||||
template.exchange<List<Foo>>(url, method)
|
||||
verify(template, times(1)).exchange(url, method, null,
|
||||
object : ParameterizedTypeReference<List<Foo>>() {})
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `RestOperations are available`() {
|
||||
val extensions = Class.forName(
|
||||
|
||||
Reference in New Issue
Block a user