@Test
public void testIdCertGetsRegenerated() throws Exception {
// using lconsumer simply to avoid hiding consumer. This should
// get renamed once we refactor this test suite.
IdentityCertServiceAdapter mockedIdSvc = Mockito
.mock(IdentityCertServiceAdapter.class);
EventSink sink = Mockito.mock(EventSinkImpl.class);
SubscriptionServiceAdapter ssa = Mockito.mock(SubscriptionServiceAdapter.class);
ComplianceRules rules = Mockito.mock(ComplianceRules.class);
Consumer consumer = createConsumer();
ComplianceStatus status = new ComplianceStatus();
when(rules.getStatus(any(Consumer.class), any(Date.class), anyBoolean())).thenReturn(status);
// cert expires today which will trigger regen
consumer.setIdCert(createIdCert());
BigInteger origserial = consumer.getIdCert().getSerial().getSerial();
when(mockedConsumerCurator.verifyAndLookupConsumer(consumer.getUuid())).thenReturn(
consumer);
when(mockedIdSvc.regenerateIdentityCert(consumer)).thenReturn(
createIdCert());
ConsumerResource cr = new ConsumerResource(mockedConsumerCurator, null,
null, ssa, null, mockedIdSvc, null, null, sink, eventFactory, null, null,
null, null, null, null, mockedOwnerCurator, null, null, rules, null,