EventFactory { public Event ownerContentAccessModeChanged(Owner owner) { return getEventBuilder(Target.OWNER_CONTENT_ACCESS_MODE, Type.MODIFIED).setEventData(owner) .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 testOwnerContentAccessModeChanged() { Owner owner = mock(Owner.class); when(owner.getName()).thenReturn("owner-name"); when(owner.getOwnerId()).thenReturn("owner-id"); when(owner.getContentAccessMode()).thenReturn("org_environment"); Event event = eventFactory.ownerContentAccessModeChanged(owner); assertEquals(Target.OWNER_CONTENT_ACCESS_MODE, event.getTarget()); assertEquals(Type.MODIFIED, event.getType()); assertEquals(owner.getName(), event.getTargetName()); assertEquals(owner.getOwnerId(), event.getOwnerId()); assertEquals("{\"contentAccessMode\":\"org_environment\"}", event.getEventData()); }