AnonymousManagerImpl extends ComponentSupport implements AnonymousManager, EventAware { @Override public void setConfiguration(final AnonymousConfiguration configuration) { checkNotNull(configuration); AnonymousConfiguration model = configuration.copy(); log.info("Saving configuration: {}", model); synchronized (lock) { if (!EventHelper.isReplicating()) { store.save(model); } this.configuration = model; } eventManager.post(new AnonymousConfigurationChangedEvent(model)); } @Inject  AnonymousManagerImpl(final EventManager eventManager,
                              final AnonymousConfigurationStore store,
                              @Named("initial") final Provider<AnonymousConfiguration> defaults); @Override boolean isConfigured(); @Override AnonymousConfiguration getConfiguration(); @Override AnonymousConfiguration newConfiguration(); @Override void setConfiguration(final AnonymousConfiguration configuration); @Override @ManagedAttribute boolean isEnabled(); @Override Subject buildSubject(); @Subscribe void onStoreChanged(final AnonymousConfigurationEvent event);  }
@Test public void testSetConfiguration() { manager.setConfiguration(storeConfig); verify(store).save(storeConfigCopy); ArgumentCaptor<AnonymousConfigurationChangedEvent> eventCaptor = ArgumentCaptor .forClass(AnonymousConfigurationChangedEvent.class); verify(eventManager).post(eventCaptor.capture()); assertThat(eventCaptor.getValue().getConfiguration(), is(storeConfigCopy)); }