### Question:
RepositoryVersionDAO extends CrudDAO<RepositoryVersionEntity, Long> { @RequiresSession public RepositoryVersionEntity findByStackAndVersion(StackId stackId, String version) { return findByStackNameAndVersion(stackId.getStackName(), version); } 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 testFindByStackAndVersion() { createSingleRecord(); Assert.assertNull(repositoryVersionDAO.findByStackAndVersion(BAD_STACK, "non existing")); Assert.assertNotNull(repositoryVersionDAO.findByStackAndVersion(HDP_206, "version")); }
@Test public void testDelete() { createSingleRecord(); Assert.assertNotNull(repositoryVersionDAO.findByStackAndVersion(HDP_206, "version")); final RepositoryVersionEntity entity = repositoryVersionDAO.findByStackAndVersion( HDP_206, "version"); repositoryVersionDAO.remove(entity); Assert.assertNull(repositoryVersionDAO.findByStackAndVersion(HDP_206, "version")); }