bobUser.setId(2L);
bobUser.getCustomer().setId(2L);
bobUser.getCustomer().getCart().setId(2L);
// Configure Alice's Cart with Items
Cart aliceCart = aliceUser.getCustomer().getCart();
Item book1 = DatabaseLoader.buildBookItemCryptonomicon();
book1.setId(1L);
Item book2 = DatabaseLoader.buildBookItemQuantumThief();
book2.setId(2L);
aliceCart.setItemQuantity(book1, 1);
aliceCart.setItemQuantity(book2, 2);
// Configure Bob's Cart with Items
Cart bobCart = bobUser.getCustomer().getCart();
Item book3 = DatabaseLoader.buildBookItemCompleteWorks();
book3.setId(3L);
Item book4 = DatabaseLoader.buildBookItemPlumbing();
book4.setId(4L);
bobCart.setItemQuantity(book3, 3);
bobCart.setItemQuantity(book4, 4);
// Create some mock results
List<Cart> cartList1 = Lists.newArrayList(aliceCart);
List<Cart> cartList2 = Lists.newArrayList(bobCart);
PaginatedList<Cart> page1 = PaginatedLists.newPaginatedArrayList(1, 2, 1, cartList1);
PaginatedList<Cart> page2 = PaginatedLists.newPaginatedArrayList(2, 2, 1, cartList2);
// Configure Cart DAO
when(cartDao.getById(aliceCart.getId())).thenReturn(Optional.of(aliceCart));
when(cartDao.getById(bobCart.getId())).thenReturn(Optional.of(bobCart));
when(cartDao.getPaginatedList(1, 1)).thenReturn(page1);
when(cartDao.getPaginatedList(1, 2)).thenReturn(page2);
when(cartDao.saveOrUpdate(aliceCart)).thenReturn(aliceCart);
when(cartDao.saveOrUpdate(bobCart)).thenReturn(bobCart);