### Question:
HostVersionDAO extends CrudDAO<HostVersionEntity, Long> { @RequiresSession public List<HostVersionEntity> findByClusterStackAndVersion( String clusterName, StackId stackId, String version) { final TypedQuery<HostVersionEntity> query = entityManagerProvider.get().createNamedQuery("hostVersionByClusterAndStackAndVersion", HostVersionEntity.class); query.setParameter("clusterName", clusterName); query.setParameter("stackName", stackId.getStackName()); query.setParameter("stackVersion", stackId.getStackVersion()); query.setParameter("version", version); return daoUtils.selectList(query); } HostVersionDAO(); @Override @Transactional void create(HostVersionEntity entity); @RequiresSession List<HostVersionEntity> findByClusterStackAndVersion(
      String clusterName, StackId stackId, String version); @RequiresSession List<HostVersionEntity> findByHost(String hostName); @RequiresSession List<HostVersionEntity> findByClusterAndHost(String  clusterName, String hostName); @RequiresSession List<HostVersionEntity> findByCluster(String  clusterName); @RequiresSession List<HostVersionEntity> findByClusterAndState(String clusterName, RepositoryVersionState state); @RequiresSession List<HostVersionEntity> findByClusterHostAndState(String  clusterName, String hostName, RepositoryVersionState state); @RequiresSession HostVersionEntity findByClusterStackVersionAndHost(String clusterName,
      StackId stackId, String version, String hostName); @RequiresSession List<HostVersionEntity> findHostVersionByClusterAndRepository(long clusterId,
      RepositoryVersionEntity repositoryVersion); @RequiresSession List<HostVersionEntity> findByRepositoryAndStates(RepositoryVersionEntity repositoryVersion,
      Collection<RepositoryVersionState> states); @RequiresSession HostVersionEntity findHostVersionByHostAndRepository(HostEntity host,
      RepositoryVersionEntity repositoryVersion); @Transactional void removeByHostName(String hostName);  }### Answer:
@Test public void testFindByClusterStackAndVersion() { Assert.assertEquals(3, hostVersionDAO.findByClusterStackAndVersion("test_cluster1", HDP_22_STACK, repoVersion_2200).size()); Assert.assertEquals(3, hostVersionDAO.findAll().size()); addMoreVersions(); Assert.assertEquals(3, hostVersionDAO.findByClusterStackAndVersion("test_cluster1", HDP_22_STACK, repoVersion_2201).size()); Assert.assertEquals(3, hostVersionDAO.findByClusterStackAndVersion("test_cluster1", HDP_22_STACK, repoVersion_2202).size()); Assert.assertEquals(9, hostVersionDAO.findAll().size()); }