June 2014
Intermediate to advanced
284 pages
6h 9m
English
In this recipe, we will perform the verification of the interaction with a mock, but at the same time, we will ignore the stubbed methods from this verification.
For this recipe, our system under test will be a TaxTransferer class that will transfer tax through the web service for the given person if this person is not null. It will send a statistics report regardless of the fact whether the transfer took place or not:
public class TaxTransferer { private final TaxService taxService; public TaxTransferer(TaxService taxService) { this.taxService = taxService; } public boolean transferTaxFor(Person person) { if(person != null) { taxService.transferTaxFor(person); } return taxService.sendStatisticsReport(); ...Read now
Unlock full access