@Test
public void testLookupOwnersByActiveProductWithExpiredEntitlements() {
Owner owner = createOwner();
Product product = TestUtil.createProduct();
Product provided = TestUtil.createProduct();
productCurator.create(product);
productCurator.create(provided);
Set<ProvidedProduct> providedProducts = new HashSet<ProvidedProduct>();
ProvidedProduct providedProduct = new ProvidedProduct(
provided.getId(), "Test Provided Product");
providedProducts.add(providedProduct);
// Create pool with end date in the past.
Pool pool = new Pool(owner, product.getId(), product.getName(),
providedProducts, Long.valueOf(5), TestUtil.createDate(2009,
11, 30), TestUtil.createDate(2010, 11, 30), "SUB234598S",
"ACC123", "ORD222");
providedProduct.setPool(pool);
poolCurator.create(pool);
Consumer consumer = createConsumer(owner);
consumerCurator.create(consumer);
EntitlementCertificate cert = createEntitlementCertificate("key", "certificate");
Entitlement ent = createEntitlement(owner, consumer, pool, cert);
entitlementCurator.create(ent);
List<String> productIds = new ArrayList<String>();
productIds.add(provided.getId());
List<Owner> results = ownerCurator.lookupOwnersByActiveProduct(productIds);
assertTrue(results.isEmpty());
}