### Question:
RepositoryVersionDAO extends CrudDAO<RepositoryVersionEntity, Long> { @RequiresSession public List<RepositoryVersionEntity> findByStack(StackId stackId) { final TypedQuery<RepositoryVersionEntity> query = entityManagerProvider.get().createNamedQuery("repositoryVersionByStack", RepositoryVersionEntity.class); query.setParameter("stackName", stackId.getStackName()); query.setParameter("stackVersion", stackId.getStackVersion()); return daoUtils.selectList(query); } RepositoryVersionDAO(); @Override @Transactional void create(RepositoryVersionEntity entity); @RequiresSession RepositoryVersionEntity findByDisplayName(String displayName); @RequiresSession RepositoryVersionEntity findByStackAndVersion(StackId stackId,
      String version); @RequiresSession RepositoryVersionEntity findByStackAndVersion(StackEntity stackEntity,
      String version); @RequiresSession RepositoryVersionEntity findByStackNameAndVersion(String stackName, String version); @RequiresSession List<RepositoryVersionEntity> findByStack(StackId stackId); @RequiresSession List<RepositoryVersionEntity> findByStackAndType(StackId stackId, RepositoryType type); RepositoryVersionEntity create(StackEntity stackEntity,
                                        String version, String displayName,
                                        List<RepoOsEntity> repoOsEntities); @Transactional RepositoryVersionEntity create(StackEntity stackEntity,
                                        String version, String displayName, List<RepoOsEntity> repoOsEntities,
                                        RepositoryType type); @RequiresSession List<RepositoryVersionEntity> findRepositoriesWithVersionDefinitions(); @RequiresSession RepositoryVersionEntity findByVersion(String repositoryVersion); @RequiresSession List<RepositoryVersionEntity> findByServiceDesiredVersion(List<RepositoryVersionEntity> matching);  }### Answer:
@Test public void testFindByStack() { createSingleRecord(); Assert.assertEquals(0, repositoryVersionDAO.findByStack(BAD_STACK).size()); Assert.assertEquals(1, repositoryVersionDAO.findByStack(HDP_206).size()); }