### Question:
HibernateMessageTemplateDAO extends HibernatePersistentObjectDAO<MessageTemplate> implements MessageTemplateDAO { @Override public List<MessageTemplate> findByTypeAndLanguage(String type, String language, long tenantId) { StringBuffer query = new StringBuffer("_entity.language='" + language + "' "); query.append(" and _entity.tenantId=" + tenantId); if (StringUtils.isNotEmpty(type)) query.append(" and _entity.type='" + type + "' "); try { return findByWhere(query.toString(), "order by _entity.name", null); } catch (PersistenceException e) { log.error(e.getMessage(), e); return new ArrayList<MessageTemplate>(); } } HibernateMessageTemplateDAO(); @Override List<MessageTemplate> findByLanguage(String language, long tenantId); @Override List<MessageTemplate> findByTypeAndLanguage(String type, String language, long tenantId); @Override MessageTemplate findByNameAndLanguage(String name, String language, long tenantId); @Override boolean delete(long id, int code); @Override List<MessageTemplate> findByName(String name, long tenantId);  }### Answer:
@Test public void testFindByTypeLanguage() { Collection<MessageTemplate> coll = dao.findByTypeAndLanguage(MessageTemplate.TYPE_SYSTEM,"en", 1L); Assert.assertEquals(4, coll.size()); coll = dao.findByTypeAndLanguage("xxx","en", 1L); Assert.assertEquals(0, coll.size()); }