use of org.candlepin.model.OwnerProductCurator in project candlepin by candlepin.
the class OwnerProductResourceTest method testDeleteProductWithSubscriptions.
@Test(expected = BadRequestException.class)
public void testDeleteProductWithSubscriptions() {
OwnerCurator oc = mock(OwnerCurator.class);
OwnerProductCurator opc = mock(OwnerProductCurator.class);
ProductCurator pc = mock(ProductCurator.class);
I18n i18n = I18nFactory.getI18n(getClass(), Locale.US, I18nFactory.FALLBACK);
OwnerProductResource pr = new OwnerProductResource(config, i18n, oc, null, opc, null, pc, null, this.modelTranslator);
Owner o = mock(Owner.class);
Product p = mock(Product.class);
when(oc.lookupByKey(eq("owner"))).thenReturn(o);
when(opc.getProductById(eq(o), eq("10"))).thenReturn(p);
Set<Subscription> subs = new HashSet<>();
Subscription s = mock(Subscription.class);
subs.add(s);
when(pc.productHasSubscriptions(eq(o), eq(p))).thenReturn(true);
pr.deleteProduct("owner", "10");
}
Aggregations