Class RootUriRequestExpectationManager
java.lang.Object
org.springframework.boot.restclient.test.RootUriRequestExpectationManager
- All Implemented Interfaces:
RequestExpectationManager
@Deprecated(since="4.2.0",
forRemoval=true)
public class RootUriRequestExpectationManager
extends Object
implements RequestExpectationManager
Deprecated, for removal: This API element is subject to removal in a future version.
since 4.2.0 for removal in 4.4.0 with no replacement
RequestExpectationManager that strips the specified root URI from the request
before verification. Can be used to simply test declarations when all REST calls start
the same way. For example:
RestTemplate restTemplate = new RestTemplateBuilder().baseUri("https://example.com").build();
MockRestServiceServer server = RootUriRequestExpectationManager.bindTo(restTemplate);
server.expect(requestTo("/hello")).andRespond(withSuccess());
restTemplate.getForEntity("/hello", String.class);
- Since:
- 4.0.0
- Author:
- Phillip Webb
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRootUriRequestExpectationManager(String rootUri, RequestExpectationManager expectationManager) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionstatic MockRestServiceServerbindTo(RestTemplate restTemplate) Deprecated, for removal: This API element is subject to removal in a future version.Return a boundMockRestServiceServerfor the givenRestTemplate, configured withRootUriRequestExpectationManagerwhen possible.static MockRestServiceServerbindTo(RestTemplate restTemplate, RequestExpectationManager expectationManager) Deprecated, for removal: This API element is subject to removal in a future version.Return a boundMockRestServiceServerfor the givenRestTemplate, configured withRootUriRequestExpectationManagerwhen possible.expectRequest(ExpectedCount count, RequestMatcher requestMatcher) Deprecated, for removal: This API element is subject to removal in a future version.static RequestExpectationManagerforRestTemplate(RestTemplate restTemplate, RequestExpectationManager expectationManager) Deprecated, for removal: This API element is subject to removal in a future version.ReturnRequestExpectationManagerto be used for binding with the specifiedRestTemplate.voidreset()Deprecated, for removal: This API element is subject to removal in a future version.validateRequest(ClientHttpRequest request) Deprecated, for removal: This API element is subject to removal in a future version.voidverify()Deprecated, for removal: This API element is subject to removal in a future version.voidDeprecated, for removal: This API element is subject to removal in a future version.
-
Constructor Details
-
RootUriRequestExpectationManager
public RootUriRequestExpectationManager(String rootUri, RequestExpectationManager expectationManager) Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
expectRequest
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
expectRequestin interfaceRequestExpectationManager
-
validateRequest
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
validateRequestin interfaceRequestExpectationManager- Throws:
IOException
-
verify
public void verify()Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
verifyin interfaceRequestExpectationManager
-
verify
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
verifyin interfaceRequestExpectationManager
-
reset
public void reset()Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
resetin interfaceRequestExpectationManager
-
bindTo
Deprecated, for removal: This API element is subject to removal in a future version.Return a boundMockRestServiceServerfor the givenRestTemplate, configured withRootUriRequestExpectationManagerwhen possible.- Parameters:
restTemplate- the source REST template- Returns:
- a configured
MockRestServiceServer
-
bindTo
public static MockRestServiceServer bindTo(RestTemplate restTemplate, RequestExpectationManager expectationManager) Deprecated, for removal: This API element is subject to removal in a future version.Return a boundMockRestServiceServerfor the givenRestTemplate, configured withRootUriRequestExpectationManagerwhen possible.- Parameters:
restTemplate- the source REST templateexpectationManager- the sourceRequestExpectationManager- Returns:
- a configured
MockRestServiceServer
-
forRestTemplate
public static RequestExpectationManager forRestTemplate(RestTemplate restTemplate, RequestExpectationManager expectationManager) Deprecated, for removal: This API element is subject to removal in a future version.ReturnRequestExpectationManagerto be used for binding with the specifiedRestTemplate. If theRestTemplateis using aRootUriTemplateHandlerthen aRootUriRequestExpectationManageris returned, otherwise the source manager is returned unchanged.- Parameters:
restTemplate- the source REST templateexpectationManager- the sourceRequestExpectationManager- Returns:
- a
RequestExpectationManagerto be bound to the template
-