Commit d4c91d2f authored by sdeleuze's avatar sdeleuze Committed by Stephane Nicoll

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
parent b7a99335
......@@ -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(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment