use of org.candlepin.controller.OwnerManager in project candlepin by candlepin.
the class OwnerResourceTest method testConflictOnDelete.
@Test(expected = ConflictException.class)
public void testConflictOnDelete() {
Owner o = mock(Owner.class);
OwnerCurator oc = mock(OwnerCurator.class);
ProductCurator pc = mock(ProductCurator.class);
OwnerManager ownerManager = mock(OwnerManager.class);
EventFactory eventFactory = mock(EventFactory.class);
OwnerResource or = new OwnerResource(oc, pc, null, null, i18n, null, eventFactory, null, null, null, poolManager, ownerManager, null, null, null, null, null, null, null, null, null, null, contentOverrideValidator, serviceLevelValidator, null, null, null, null, null, this.modelTranslator);
when(oc.lookupByKey(eq("testOwner"))).thenReturn(o);
ConstraintViolationException ce = new ConstraintViolationException(null, null, null);
PersistenceException pe = new PersistenceException(ce);
Mockito.doThrow(pe).when(ownerManager).cleanupAndDelete(eq(o), eq(true));
or.deleteOwner("testOwner", true, true);
}
Aggregations