TaxCalculatorService { public Money calculateTax(Employee employee) { runningTimeService.sleep(); double taxAmount = employee.getIncome() * 0.1; Money tax = Money.of(CurrencyUnit.EUR, taxAmount, RoundingMode.HALF_DOWN); return tax; }  Money calculateTax(Employee employee); void setRunningTimeService(RunningTimeService runningTimeService);  }
@Test public void testCalculateTax() throws Exception { Money actualMoney = taxCalculatorService.calculateTax(employee); Money expectedMoney = Money.of(CurrencyUnit.EUR, 10); assertThat(actualMoney).isEqualTo(expectedMoney); }
@Test public void testCalculateTaxSleeps() throws Exception { taxCalculatorService.calculateTax(employee); verify(runningTimeService).sleep(); }