### Question:
HibernateGenericDAO extends HibernatePersistentObjectDAO<Generic> implements GenericDAO { @Override public List<Generic> findByTypeAndSubtype(String type, String subtype, Long qualifier, Long tenantId) { String query = " 1=1 "; if (StringUtils.isNotEmpty(type)) query += " and _entity.type like '" + SqlUtil.doubleQuotes(type) + "' "; if (StringUtils.isNotEmpty(subtype)) query += " and _entity.subtype like '" + SqlUtil.doubleQuotes(subtype) + "' "; if (qualifier != null) query += " and _entity.qualifier = " + qualifier; if (tenantId != null) query += " and _entity.tenantId = " + tenantId; try { return findByWhere(query, null, null); } catch (PersistenceException e) { log.error(e.getMessage(), e); return new ArrayList<Generic>(); } } HibernateGenericDAO(); @Override boolean delete(long genericId, int code); @Override Generic findByAlternateKey(String type, String subtype, Long qualifier, long tenantId); @Override List<Generic> findByTypeAndSubtype(String type, String subtype, Long qualifier, Long tenantId); @Override void initialize(Generic generic); @Override boolean store(Generic entity);  }### Answer:
@Test public void testFindByTypeAndSubtype() { List<Generic> generics = dao.findByTypeAndSubtype("a", "a%", null, null); Assert.assertEquals(2, generics.size()); generics = dao.findByTypeAndSubtype("a", "a%", null, Tenant.DEFAULT_ID); Assert.assertEquals(2, generics.size()); generics = dao.findByTypeAndSubtype("a", "a%", null, 99L); Assert.assertEquals(0, generics.size()); }