Reputation: 312
Since upgrading spring-integration to 5.3.10.RELEASE we can't mock the requestFactory on HttpRequestExecutingMessageHandler anymore in the unit tests, it is actually checked if the requestFactory setter has been called and an exception is thrown in that case. So, how to configure the HttpRequestExecutingMessageHandler.requestFactory now with a Mockito instance?
Upvotes: 0
Views: 229
Reputation: 121552
The check there is like this:
public void setRequestFactory(ClientHttpRequestFactory requestFactory) {
assertLocalRestTemplate("requestFactory");
this.restTemplate.setRequestFactory(requestFactory);
}
That means that you have been providing a RestTemplate
into this HttpRequestExecutingMessageHandler
. The requestFactory
is essentially a property of the RestTemplate
. So, consider to set your mock into that external RestTemplate
instead.
Upvotes: 0