@Test public void confirmingOrderEmptiesCart() throws Exception { testee.addBookToCart(2); testee.confirmOrder(); assertEquals(0, testee.getCart().getBookCount()); assertEquals( asList(testee.findBookById(2)), testee.getCheckout().getConfirmedOrder().getBooks()); }
@Test(expected = BookNotFoundException.class) public void notFindingABookCausesBookNotFoundException() throws Exception { testee.findBookById(3); }
@Test public void addBookToCart() throws Exception { testee.addBookToCart(1); assertEquals(1, testee.getCart().getBookCount()); assertEquals(asList(testee.findBookById(1)), testee.getCart().getBooks()); }
@Test public void shouldBeAbleToFindABookById() throws Exception { assertEquals(1, testee.findBookById(1).getId()); assertEquals(2, testee.findBookById(2).getId()); }