List<Pool> pools = Util.newList();
Pool pool1 = TestUtil.createPool(product);
pools.add(pool1);
Date now = new Date();
ValidationResult result = mock(ValidationResult.class);
// Setup an installed product for the consumer, we'll make the bind request
// with no products specified, so this should get used instead:
String [] installedPids = new String [] { product.getId() };
ComplianceStatus mockCompliance = new ComplianceStatus(now);
mockCompliance.addNonCompliantProduct(installedPids[0]);
when(complianceRules.getStatus(any(Consumer.class),
any(Date.class), any(Boolean.class))).thenReturn(mockCompliance);
Page page = mock(Page.class);
when(page.getPageData()).thenReturn(pools);
when(mockPoolCurator.listAvailableEntitlementPools(any(Consumer.class),
any(Owner.class), anyString(), eq(now),
anyBoolean(), any(PoolFilterBuilder.class),
any(PageRequest.class), anyBoolean()))
.thenReturn(page);
when(mockPoolCurator.lockAndLoad(any(Pool.class))).thenReturn(pool1);
when(enforcerMock.preEntitlement(any(Consumer.class), any(Pool.class), anyInt(),
any(CallerType.class))).thenReturn(result);
when(result.isSuccessful()).thenReturn(true);
List<PoolQuantity> bestPools = new ArrayList<PoolQuantity>();
bestPools.add(new PoolQuantity(pool1, 1));
when(autobindRules.selectBestPools(any(Consumer.class), any(String[].class),
any(List.class), any(ComplianceStatus.class), any(String.class),