O'Reilly logo

Mastering Spring Cloud by Piotr Minkowski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testing the rule

The sample we are discussing here is available on GitHub. To access it, you have to switch to  weighted_lb branch (https://github.com/piomin/sample-spring-cloud-comm/tree/weighted_lb). Our JUnit test class, called CustomerControllerTest, is available under the src/test/java directory. To enable Hoverfly for the test, we should define the JUnit @ClassRule. The HoverflyRule class provides an API that allows us to simulate many services with different addresses, characteristics, and responses. In the following source code fragment, you may see that two instances of our sample microservice account-service have been declared inside @ClassRule.  As you probably remember, that service has been invoked by customer-service and order-service ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required