EnvironmentCurator extends AbstractHibernateCurator<Environment> { @SuppressWarnings("unchecked") public List<Environment> listWithContent(Set<String> contentIds) { return currentSession().createCriteria(Environment.class) .createCriteria("environmentContent") .createCriteria("content") .add(Restrictions.in("id", contentIds)) .list(); } EnvironmentCurator(); Environment getConsumerEnvironment(Consumer consumer); CandlepinQuery<Consumer> getEnvironmentConsumers(Environment environment); CandlepinQuery<Consumer> getEnvironmentConsumers(String environmentId); @SuppressWarnings("unchecked") CandlepinQuery<Environment> listForOwner(Owner o); @SuppressWarnings("unchecked") CandlepinQuery<Environment> listForOwnerByName(Owner o, String envName); @SuppressWarnings("unchecked") List<Environment> listWithContent(Set<String> contentIds); int deleteEnvironmentsForOwner(Owner owner); String getEnvironmentIdByName(String ownerId, String envName);  }
@Test public void listWithContent() { envCurator.create(new Environment("env2", "Another Env", owner)); final String contentId = "contentId"; Content content = this.createContent(contentId, "test content", this.owner); envContentCurator.create(new EnvironmentContent(environment, content, true)); Set<String> ids = new HashSet<>(); ids.add(contentId); List<Environment> envs = envCurator.listWithContent(ids); assertEquals(1, envs.size()); assertEquals(environment, envs.get(0)); }