Package-level declarations

Web client test utilities.

Types

Link copied to clipboard
UriTemplateHandler will automatically prefix relative URIs with localhost:${local.server.port}.
Link copied to clipboard
Link copied to clipboard
RequestExpectationManager that strips the specified root URI from the request before verification.
Link copied to clipboard
open class TestRestTemplate
Convenient alternative of RestTemplate that is suitable for integration tests.

Functions

Link copied to clipboard
inline fun <T : Any> TestRestTemplate.exchange(requestEntity: RequestEntity<*>): ResponseEntity<T>
inline fun <T : Any> TestRestTemplate.exchange(url: URI, method: HttpMethod, requestEntity: HttpEntity<*>? = null): ResponseEntity<T>
inline fun <T : Any> TestRestTemplate.exchange(url: String, method: HttpMethod, requestEntity: HttpEntity<*>? = null, vararg uriVariables: Any): ResponseEntity<T>
inline fun <T : Any> TestRestTemplate.exchange(url: String, method: HttpMethod, requestEntity: HttpEntity<*>? = null, uriVariables: Map<String, *>): ResponseEntity<T>

Extension for TestRestTemplate.exchange providing an exchange<Foo>(...) variant leveraging Kotlin reified type parameters. This extension is not subject to type erasure and retains actual generic type arguments.

Link copied to clipboard
inline fun <T : Any> TestRestTemplate.getForEntity(url: String, vararg uriVariables: Any): ResponseEntity<T>
inline fun <T : Any> TestRestTemplate.getForEntity(url: String, uriVariables: Map<String, *>): ResponseEntity<T>

Extension for TestRestTemplate.getForEntity providing a getForEntity<Foo>(...) variant leveraging Kotlin reified type parameters. Like the original Java method, this extension is subject to type erasure. Use exchange if you need to retain actual generic type arguments.

Link copied to clipboard
inline fun <T : Any> TestRestTemplate.getForObject(url: URI): T?
inline fun <T : Any> TestRestTemplate.getForObject(url: String, vararg uriVariables: Any): T?
inline fun <T : Any> TestRestTemplate.getForObject(url: String, uriVariables: Map<String, Any?>): T?

Extension for TestRestTemplate.getForObject providing a getForObject<Foo>(...) variant leveraging Kotlin reified type parameters. Like the original Java method, this extension is subject to type erasure. Use exchange if you need to retain actual generic type arguments.

Link copied to clipboard
inline fun <T : Any> TestRestTemplate.patchForObject(url: URI, request: Any? = null): T?
inline fun <T : Any> TestRestTemplate.patchForObject(url: String, request: Any? = null, vararg uriVariables: Any): T?
inline fun <T : Any> TestRestTemplate.patchForObject(url: String, request: Any? = null, uriVariables: Map<String, *>): T?

Extension for TestRestTemplate.patchForObject providing a patchForObject<Foo>(...) variant leveraging Kotlin reified type parameters. Like the original Java method, this extension is subject to type erasure. Use exchange if you need to retain actual generic type arguments.

Link copied to clipboard
inline fun <T : Any> TestRestTemplate.postForEntity(url: URI, request: Any? = null): ResponseEntity<T>
inline fun <T : Any> TestRestTemplate.postForEntity(url: String, request: Any? = null, vararg uriVariables: Any): ResponseEntity<T>
inline fun <T : Any> TestRestTemplate.postForEntity(url: String, request: Any? = null, uriVariables: Map<String, *>): ResponseEntity<T>

Extension for TestRestTemplate.postForEntity providing a postForEntity<Foo>(...) variant leveraging Kotlin reified type parameters. Like the original Java method, this extension is subject to type erasure. Use exchange if you need to retain actual generic type arguments.

Link copied to clipboard
inline fun <T : Any> TestRestTemplate.postForObject(url: URI, request: Any? = null): T?
inline fun <T : Any> TestRestTemplate.postForObject(url: String, request: Any? = null, vararg uriVariables: Any): T?
inline fun <T : Any> TestRestTemplate.postForObject(url: String, request: Any? = null, uriVariables: Map<String, *>): T?

Extension for TestRestTemplate.postForObject providing a postForObject<Foo>(...) variant leveraging Kotlin reified type parameters. Like the original Java method, this extension is subject to type erasure. Use exchange if you need to retain actual generic type arguments.