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 ...

Get Mastering Spring Cloud now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.