CollectionDao extends HibernateDao<Collection, String> { @Override public void delete (final Collection collection) { cfgManager.getScannerManager().deleteCollectionReferences(collection.getName()); super.delete (collection); }  @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; }
@Override @Test(dependsOnMethods = "count") public void delete () { String id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1"; User root = udao.getRootUser (); int expectedCount = dao.count () - 1; Collection collection = dao.read (id); Assert.assertNotNull (collection); List<Long> products = dao.getProductIds (id, null); dao.delete (collection); Assert.assertNull (dao.read (id)); Assert.assertEquals (dao.count (), expectedCount); for (Long pid : products) { Assert.assertNotNull (pdao.read (pid)); } }