コード例 #1
0
 @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());
 }
コード例 #2
0
 @Test
 public void addBookToCart() throws Exception {
   testee.addBookToCart(1);
   assertEquals(1, testee.getCart().getBookCount());
   assertEquals(asList(testee.findBookById(1)), testee.getCart().getBooks());
 }
コード例 #3
0
 @Test
 public void shouldBeAbleToFindABookById() throws Exception {
   assertEquals(1, testee.findBookById(1).getId());
   assertEquals(2, testee.findBookById(2).getId());
 }
コード例 #4
0
 @Test(expected = BookNotFoundException.class)
 public void notFindingABookCausesBookNotFoundException() throws Exception {
   testee.findBookById(3);
 }
コード例 #5
0
 @Before
 public void setUp() throws Exception {
   testee = new BookStoreApplication();
   testee.addBook(new Book(1));
   testee.addBook(new Book(2));
 }