### Question:
HibernateGroupDAO extends HibernatePersistentObjectDAO<Group> implements GroupDAO { public boolean delete(long groupId, int code) { assert (code != 0); boolean result = true; try { Group group = findById(groupId); refresh(group); if (group.getName().equals("admin") || group.getName().equals("guest") || group.getName().equals("publisher")) throw new Exception(String.format("Group %s cannot be deleted", group.getName())); if (group != null) { group.setName(group.getName() + "." + group.getId()); group.setDeleted(code); saveOrUpdate(group); } } catch (Throwable e) { log.error(e.getMessage(), e); result = false; } return result; } private  HibernateGroupDAO(); MenuDAO getMenuDAO(); void setMenuDAO(MenuDAO menuDAO); boolean delete(long groupId, int code); boolean exists(String groupname, long tenantId); @Override Collection<String> findAllGroupNames(long tenantId); @Override Group findByName(String name, long tenantId); @Override boolean insert(Group group, long parentGroupId); @Override void inheritACLs(Group group, long parentGroupId); @Override Collection<Group> findByLikeName(String name, long tenantId); @Override int count(); @Override void initialize(Group group); @Override boolean store(Group group); @Override void fixGuestPermissions(Group group);  }### Answer:
@Test public void testDelete() throws PersistenceException { Assert.assertNotNull(dao.findById(10)); Assert.assertTrue(dao.delete(10)); Assert.assertNull(dao.findById(10)); Assert.assertFalse(dao.delete(1)); }