ProductCartDao extends HibernateDao<ProductCart, String> { public ProductCart getCartOfUser(final User user) { return (ProductCart)firstResult(getCartsOfUser(user)); }  static T firstResult(Collection<T> results); ProductCart getCartOfUser(final User user); @SuppressWarnings ("unchecked") List<ProductCart> getCartsOfUser(final User user); void deleteCartOfUser(User user); void deleteProductReferences(final Product product); List<Product> scrollCartOfUser(final User user, final int skip,
         final int top); List<Long> getProductsIdOfCart(User user);  }
@Test public void getCartOfUser () { User user = udao.read ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa3"); ProductCart cart = dao.getCartOfUser (user); assertNotNull (cart); assertEquals (cart.getUUID(), "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1"); assertEquals (cart.getUser(), user, "User not owner of the found cart."); user = udao.read ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1"); cart = dao.getCartOfUser (user); assertNull (cart); user = udao.read ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2"); cart = dao.getCartOfUser (user); assertNotNull (cart); }