June 2014
Intermediate to advanced
284 pages
6h 9m
English
In the previous recipe, we saw how to create a mock by means of the Mockito.mock static method. It's much better, however, to use Mockito's annotations to make your tests look even nicer. Before going into the details of how to do it, let's take a closer look at the system under test (it's the same as in the previous recipe, but in order for you not to jump around pages, let's take a look at it here).
In this recipe, our system under test is a class that calculates a mean value of tax factors retrieved through a web service, as shown in the following code:
public class MeanTaxFactorCalculator { private final TaxService taxService; public MeanTaxFactorCalculator(TaxService taxService) { this.taxService ...Read now
Unlock full access