EventFactory { public Event guestIdCreated(GuestId guestId) { return getEventBuilder(Target.GUESTID, Type.CREATED) .setEventData(guestId) .buildEvent(); } @Inject  EventFactory(PrincipalProvider principalProvider,
        @Named("EventFactoryObjectMapper") ObjectMapper objectMapper); EventBuilder getEventBuilder(Target target, Type type); Event consumerCreated(Consumer newConsumer); Event rulesUpdated(Rules oldRules, Rules newRules); Event rulesDeleted(Rules deletedRules); Event activationKeyCreated(ActivationKey key); Event consumerDeleted(Consumer oldConsumer); Event entitlementCreated(Entitlement e); Event entitlementDeleted(Entitlement e); Event entitlementExpired(Entitlement e); Event entitlementChanged(Entitlement e); Event ownerCreated(Owner newOwner); Event ownerModified(Owner newOwner); Event ownerDeleted(Owner owner); Event poolCreated(Pool newPool); Event poolDeleted(Pool pool); Event exportCreated(Consumer consumer); Event importCreated(Owner owner); Event guestIdCreated(GuestId guestId); Event guestIdDeleted(GuestId guestId); Event subscriptionExpired(SubscriptionDTO subscription); Event ownerContentAccessModeChanged(Owner owner); Event complianceCreated(Consumer consumer, ComplianceStatus compliance); Event complianceCreated(Consumer consumer, SystemPurposeComplianceStatus compliance);  }
@Test public void testGuestIdCreation() throws Exception { Consumer consumer = mock(Consumer.class); GuestId guestId = mock(GuestId.class); when(guestId.getConsumer()).thenReturn(consumer); when(guestId.getGuestId()).thenReturn("guest-id"); when(guestId.getId()).thenReturn("test"); when(consumer.getOwnerId()).thenReturn("owner-id"); when(consumer.getId()).thenReturn("consumer-id"); Event event = eventFactory.guestIdCreated(guestId); assertNotNull(event.getEntityId()); }