@Test(expected = BadRequestException.class)
public void testActivationKeyNameUnique() {
ActivationKey ak = mock(ActivationKey.class);
ActivationKey akOld = mock(ActivationKey.class);
ActivationKeyCurator akc = mock(ActivationKeyCurator.class);
Owner o = mock(Owner.class);
OwnerCurator oc = mock(OwnerCurator.class);
when(ak.getName()).thenReturn("testKey");
when(akc.lookupForOwner(eq("testKey"), eq(o))).thenReturn(akOld);
when(oc.lookupByKey(eq("testOwner"))).thenReturn(o);
OwnerResource or = new OwnerResource(oc,
null, akc, null, null, i18n, null, null, null,
null, null, null, null, null, null, null,