### Question:
DeploymentDAOJpa implements DeploymentDAO { @Override public List<Deployment> getDeploymentsForApplicationWithStatus(Application application, String status) { Query query = entityManager.createQuery("SELECT d FROM Deployment d WHERE d.application = :application AND d.status = :status"); query.setParameter("application", application); query.setParameter("status", status); @SuppressWarnings("unchecked") List<Deployment> deployments = query.getResultList(); return deployments; }  @PersistenceContext (unitName = "applicationManagerDB") void setEntityManager(EntityManager entityManager); EntityManager getEntityManager(); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) Deployment getById(int id); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) List<Deployment> getAll(); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean save(Deployment deployment); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean update(Deployment deployment); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean delete(Deployment deployment); @Override List<Deployment> getDeploymentsForApplicationWithStatus(Application application, String status); @Override Deployment getDeployment(String deploymentName); @Override List<Deployment> getDeploymentsWithStatus(String status);  }### Answer:
@Test public void getDeploymentsForApplicationWithStatus() { Application application = setupSeveralDeploymentsAndApplications(); List<Deployment> deploymentsRUNNING = deploymentDAO.getDeploymentsForApplicationWithStatus(application, "RUNNING"); assertEquals(2, deploymentsRUNNING.size()); List<Deployment> deploymentsDELETED = deploymentDAO.getDeploymentsForApplicationWithStatus(application, "DELETED"); assertEquals(1, deploymentsDELETED.size()); List<Deployment> deploymentsXXX = deploymentDAO.getDeploymentsForApplicationWithStatus(application, "XXX"); assertEquals(0, deploymentsXXX.size()); }