Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Unit test
public class TaxCalculatorTest {
@Test
public void shouldCalculateCaliforniaTaxOnOrderWithSingleItem() {
var singleItemOrder = Order.withItems(Item.withCost(50)).withCustomerLocation('CA');
var tax = TaxCalculator.calculate(singleItemOrder);
assertThat(tax).isEqualTo(3.625);
}
@Test
public void shouldAddZeroTaxOnEmptyOrder() {
var emptyOrder = Order.withItems().withCustomerLocation('CA');
var tax = TaxCalculator.calculate(emptyOrder);
assertThat(tax).isEqualTo(0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment