ProductCartDao extends HibernateDao<ProductCart, String> { public List<Long> getProductsIdOfCart(User user) { long start = System.currentTimeMillis(); List<Long> ret = toId(scrollCartOfUser(user, 0, -1)); long end = System.currentTimeMillis(); logger.info("Query getProductsIdOfCart spent " + (end - start) + "ms"); return ret; }  @SuppressWarnings("unchecked") ProductCart getCartOfUser(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 getProductsIdOfCart() { User user = new User(); user.setUUID("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0"); List<Long> ids = dao.getProductsIdOfCart(user); assertNotNull(ids); assertEquals(ids.size(), 2); assertTrue(ids.contains(Long.valueOf(0))); assertTrue(ids.contains(Long.valueOf(5))); }