0

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?

paul58914080
  • 282
  • 3
  • 8

1 Answers1

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