CollectionDao extends HibernateDao<Collection, String> { public void removeProducts (final String cid, final Long[] pids, User user) { for (Long pid : pids) removeProduct (cid, pid, user); }  @Override void delete(final Collection collection); @Override void deleteAll(); boolean contains(final String cid, final Long pid); void removeProduct(final String cid, final Long pid, User user); void removeProducts(final String cid, final Long[] pids, User user); @SuppressWarnings ("unchecked") List<Collection> getCollectionsOfProduct(final Long product_id); List<Long> getProductIds(final String collection_uuid, User user); @SuppressWarnings("unchecked") List<String> getCollectionsUUID(); String getCollectionUUIDByName(final String collection_name); Collection getByName(final String name); Iterator<Collection> getAllCollections(); final static String HIDDEN_PREFIX; final static String COLLECTION_ROOT_NAME; }
@Test (dependsOnMethods = "removeProduct") public void removeProducts () { Long[] pids = { 0L, 3L }; String cid = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1"; User user = udao.getRootUser (); for (Long pid : pids) { Assert.assertTrue (dao.contains (cid, pid)); } dao.removeProducts (cid, pids, user); for (Long pid : pids) { Assert.assertFalse (dao.contains (cid, pid)); } }