I'm fairly new to spring cloud. Is there a way we could perform integration test on Feign clients using test double like wire mocks or some kind of test double ? Is there a way I could get this mocked test double registered in the registry-server and then use it with FeignClient?
Asked
Active
Viewed 977 times
1 Answers
1
You can start your WireMock server on a predefined port (or register it as a Spring Bean). Then, for the sake of your tests, you can have a custom Configuration that will set the value of server list of the Ribbon Load Balancer to contain localhost:wiremockPort just like presented here - https://github.com/spring-cloud/spring-cloud-sleuth/blob/master/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/WebClientTests.java#L382-L395

Marcin Grzejszczak
- 10,624
- 1
- 16
- 32
-
yup, feign itself uses wiremock for testing, go look at it's source. – spencergibb Jul 13 '16 at 04:22