1
1
/*
2
- * Copyright 2002-2025 the original author or authors.
2
+ * Copyright 2002-2024 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -19,12 +19,9 @@ package org.springframework.web.client
19
19
import io.mockk.every
20
20
import io.mockk.mockk
21
21
import io.mockk.verify
22
- import org.assertj.core.api.Assertions.assertThat
23
22
import org.junit.jupiter.api.Test
24
23
import org.junit.jupiter.api.assertThrows
25
24
import org.springframework.core.ParameterizedTypeReference
26
- import org.springframework.http.HttpRequest
27
- import org.springframework.web.client.RestClient.RequestHeadersSpec
28
25
29
26
/* *
30
27
* Mock object based tests for [RestClient] Kotlin extensions
@@ -62,24 +59,6 @@ class RestClientExtensionsTests {
62
59
assertThrows<NoSuchElementException > { responseSpec.requiredBody<Foo >() }
63
60
}
64
61
65
- @Test
66
- fun `RequestHeadersSpec#requiredExchange` () {
67
- val foo = Foo ()
68
- every { requestBodySpec.exchange(any<RequestHeadersSpec .ExchangeFunction <Foo >>(), any()) } returns foo
69
- val exchangeFunction: (HttpRequest , RequestHeadersSpec .ConvertibleClientHttpResponse ) -> Foo ? =
70
- { _, _ -> foo }
71
- val value = requestBodySpec.requiredExchange(exchangeFunction)
72
- assertThat(value).isEqualTo(foo)
73
- }
74
-
75
- @Test
76
- fun `RequestHeadersSpec#requiredExchange with null response throws NoSuchElementException` () {
77
- every { requestBodySpec.exchange(any<RequestHeadersSpec .ExchangeFunction <Foo >>(), any()) } returns null
78
- val exchangeFunction: (HttpRequest , RequestHeadersSpec .ConvertibleClientHttpResponse ) -> Foo ? =
79
- { _, _ -> null }
80
- assertThrows<NoSuchElementException > { requestBodySpec.requiredExchange(exchangeFunction) }
81
- }
82
-
83
62
@Test
84
63
fun `ResponseSpec#toEntity with reified type parameters` () {
85
64
responseSpec.toEntity<List <Foo >>()
0 commit comments