### Question:
HibernateGroupDAO extends HibernatePersistentObjectDAO<Group> implements GroupDAO { @Override public Group findByName(String name, long tenantId) { Group group = null; try { Collection<Group> coll = findByWhere( "_entity.tenantId=" + tenantId + " and _entity.name = '" + SqlUtil.doubleQuotes(name) + "'", null, null); if (coll.size() > 0) { group = coll.iterator().next(); if (group.getDeleted() == 1) group = null; } } catch (PersistenceException e) { log.error(e.getMessage(), e); } return group; } 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 testFindByName() { Group group = dao.findByName("admin", 1); Assert.assertNotNull(group); Assert.assertEquals("admin", group.getName()); group = dao.findByName("xxxx", 1); Assert.assertNull(group); group = dao.findByName("admin", 99); Assert.assertNull(group); }