### Question:
AuditServiceProviderImpl implements AuditServiceProvider { @Override public AMAuditService getAuditService(String realm) { AMAuditService auditService = auditServices.get(realm); if (auditService == null) { return defaultAuditService; } else { return auditService; } } @Inject  AuditServiceProviderImpl(AuditServiceConfigurationProvider configProvider, ShutdownManager shutdownManager); @Override AMAuditService getAuditService(String realm); @Override AMAuditService getDefaultAuditService();  }### Answer:
@Test public void shouldCreateRealmAuditService() throws Exception { configListener.realmConfigurationChanged("anyRealm"); assertThat(provider.getAuditService("anyRealm")).isNotNull(); assertThat(provider.getAuditService("anyRealm")).isInstanceOf(RealmAuditServiceProxy.class); }
@Test public void shouldNotRegisterHandlersWhenRealmAuditServiceDisabled() throws Exception { auditServiceConfig = new AMAuditServiceConfiguration(false); configListener.realmConfigurationChanged("anyRealm"); assertThat(provider.getAuditService("anyRealm").getRegisteredHandler("Mock Handler")).isNull(); }