### Question:
HibernateAttributeSetDAO extends HibernatePersistentObjectDAO<AttributeSet> implements AttributeSetDAO { @Override public AttributeSet findByName(String name, long tenantId) { AttributeSet template = null; try { List<AttributeSet> coll = findByWhere( "_entity.name = '" + SqlUtil.doubleQuotes(name) + "' and _entity.tenantId=" + tenantId, null, null); if (coll.size() > 0) template = coll.iterator().next(); if (template != null && template.getDeleted() == 1) template = null; } catch (PersistenceException e) { log.error(e.getMessage(), e); } return template; } HibernateAttributeSetDAO(); @Override List<AttributeSet> findAll(); @Override List<AttributeSet> findAll(long tenantId); @Override AttributeSet findByName(String name, long tenantId); @Override boolean delete(long id, int code); @Override List<AttributeSet> findByType(int type, long tenantId); void setOptionsDao(AttributeOptionDAO optionsDao); @Override boolean store(AttributeSet set); void setTemplateDao(TemplateDAO templateDao); @Override Map<Long, AttributeSet> load(long tenantId); @Override Map<String, Attribute> findAttributes(long tenantId, Long setId);  }### Answer:
@Test public void testFindByName() { AttributeSet set = dao.findByName("default", Tenant.DEFAULT_ID); Assert.assertNotNull(set); Assert.assertEquals(-1, set.getId()); Assert.assertEquals("default", set.getName()); set = dao.findByName("xxx", Tenant.DEFAULT_ID); Assert.assertNull(set); set = dao.findByName("default", 99L); Assert.assertNull(set); }