Source:
public void testAttributeFilterLogic() { Product product1 = TestUtil.createProduct(); product1.addAttribute(new ProductAttribute("A", "foo")); product1.addAttribute(new ProductAttribute("B", "bar")); productCurator.create(product1); Product product2 = TestUtil.createProduct(); product2.addAttribute(new ProductAttribute("A", "foo")); product2.addAttribute(new ProductAttribute("B", "zoo")); productCurator.create(product2); Product product3 = TestUtil.createProduct(); product3.addAttribute(new ProductAttribute("A", "biz")); product3.addAttribute(new ProductAttribute("B", "zoo")); productCurator.create(product3); Date activeDate = TestUtil.createDate(2000, 3, 2); Pool pool1 = createPoolAndSub(owner, product1, 100L, activeDate, TestUtil.createDate(2005, 3, 2)); poolCurator.create(pool1); Pool pool2 = createPoolAndSub(owner, product2, 100L, activeDate, TestUtil.createDate(2005, 3, 2)); poolCurator.create(pool2); Pool pool3 = createPoolAndSub(owner, product3, 100L, activeDate, TestUtil.createDate(2005, 3, 2)); poolCurator.create(pool3); PageRequest req = new PageRequest(); req.setPage(1); req.setPerPage(10); req.setOrder(PageRequest.Order.ASCENDING); req.setSortBy("id"); FilterBuilder filters = new FilterBuilder(); filters.addAttributeFilter("A", "foo"); filters.addAttributeFilter("A", "biz"); filters.addAttributeFilter("B", "zoo"); Page<List<Pool>> page = poolCurator.listAvailableEntitlementPools( null, owner, null, activeDate, false, filters, req, false); List<Pool> results = page.getPageData(); assertEquals(2, results.size()); Pool[] expected = new Pool[]{ pool2, pool3 }; results.containsAll(Arrays.asList(expected)); }

Target:
public void testAttributeFilterLogic() { Product product1 = TestUtil.createProduct(); product1.addAttribute(new ProductAttribute("A", "foo")); product1.addAttribute(new ProductAttribute("B", "bar")); productCurator.create(product1); Product product2 = TestUtil.createProduct(); product2.addAttribute(new ProductAttribute("A", "foo")); product2.addAttribute(new ProductAttribute("B", "zoo")); productCurator.create(product2); Product product3 = TestUtil.createProduct(); product3.addAttribute(new ProductAttribute("A", "biz")); product3.addAttribute(new ProductAttribute("B", "zoo")); productCurator.create(product3); Date activeDate = TestUtil.createDate(2000, 3, 2); Pool pool1 = createPoolAndSub(owner, product1, 100L, activeDate, TestUtil.createDate(2005, 3, 2)); poolCurator.create(pool1); Pool pool2 = createPoolAndSub(owner, product2, 100L, activeDate, TestUtil.createDate(2005, 3, 2)); poolCurator.create(pool2); Pool pool3 = createPoolAndSub(owner, product3, 100L, activeDate, TestUtil.createDate(2005, 3, 2)); poolCurator.create(pool3); PageRequest req = new PageRequest(); req.setPage(1); req.setPerPage(10); req.setOrder(PageRequest.Order.ASCENDING); req.setSortBy("id"); FilterBuilder filters = new FilterBuilder(); filters.addAttributeFilter("A", "foo"); filters.addAttributeFilter("A", "biz"); filters.addAttributeFilter("B", "zoo"); Page<List<Pool>> page = poolCurator.listAvailableEntitlementPools( null, owner, null, activeDate, false, filters, req, false); List<Pool> results = page.getPageData(); assertEquals(2, results.size()); Pool[] expected = new Pool[]{ pool2, pool3 }; assertTrue(results.containsAll(Arrays.asList(expected))); }