@Test public void should_update_tax_factor_and_transfer_tax_in_specified_order() { Person person = new Person(); systemUnderTest.transferTaxFor(person); InOrder inOrder = Mockito.inOrder(taxService); inOrder.verify(taxService).updateTaxFactor(eq(person), anyDouble()); inOrder.verify(taxService, times(2)).transferTaxFor(person); inOrder.verify(taxService).updateTaxFactor(eq(person), anyDouble()); inOrder.verify(taxService).transferTaxFor(person); }
public void transferTaxFor(Person person) { taxService.updateTaxFactor(person, calculateTaxFactor(1)); taxService.transferTaxFor(person); taxService.transferTaxFor(person); taxService.updateTaxFactor(person, calculateTaxFactor(2)); taxService.transferTaxFor(person); }
TaxUpdater { public void transferTaxFor(Person person) { taxService.updateTaxFactor(person, calculateTaxFactor(1)); taxService.transferTaxFor(person); taxService.transferTaxFor(person); taxService.updateTaxFactor(person, calculateTaxFactor(2)); taxService.transferTaxFor(person); } }
TaxUpdater { public void transferTaxFor(Person person) { taxService.updateTaxFactor(person, calculateTaxFactor(1)); taxService.transferTaxFor(person); taxService.transferTaxFor(person); taxService.updateTaxFactor(person, calculateTaxFactor(2)); taxService.transferTaxFor(person); } TaxUpdater(TaxService taxService); }
TaxUpdater { public void transferTaxFor(Person person) { taxService.updateTaxFactor(person, calculateTaxFactor(1)); taxService.transferTaxFor(person); taxService.transferTaxFor(person); taxService.updateTaxFactor(person, calculateTaxFactor(2)); taxService.transferTaxFor(person); } TaxUpdater(TaxService taxService); void transferTaxFor(Person person); }
TaxUpdater { public void transferTaxFor(Person person) { taxService.updateTaxFactor(person, calculateTaxFactor(1)); taxService.transferTaxFor(person); taxService.transferTaxFor(person); taxService.updateTaxFactor(person, calculateTaxFactor(2)); taxService.transferTaxFor(person); } TaxUpdater(TaxService taxService); void transferTaxFor(Person person); static final int TAX_FACTOR; }