Mock an Eureka Feign Client for Unittesting

后端 未结 3 1456
南笙
南笙 2020-12-16 00:41

i am using spring cloud\'s eureka and feign to communicate between some services (lets say A and B). Now id like to unittest my service layer of a single service (A). The pr

3条回答
  •  执笔经年
    2020-12-16 00:44

    If you need to use a mock you can use Wiremock to stub the response for a given request - http://wiremock.org/stubbing.html. That way you will do integration tests with real HTTP requests sent. For unit testing the answer from @Markon is very good.

提交回复
热议问题