EventPublishingDataStore implements DataStore<K, E>, DataStoreEventPublisher { @Override public void publishEvent(DataStoreEvent event) { listenerContext.trigger(event); } EventPublishingDataStore(DataStore<K, E> delegate, RepositoryMetadata repositoryMetadata,
                                    DataStoreEventListenerContext listenerContext); @Override boolean hasKey(K key); @Override boolean save(K key, E entity); @Override boolean delete(K key); @Override E retrieve(K key); @Override Collection<K> keys(); @Override Collection<E> retrieveAll(); @Override Class<E> getEntityType(); @Override void truncate(); @Override void publishEvent(DataStoreEvent event);  }
@Test public void testEventPublishingDelegation() { final DummyEvent event = new DummyEvent(); ((EventPublishingDataStore) dataStore).publishEvent(event); assertThat(listenerContext.getEvents(), hasSize(1)); assertThat(listenerContext.getEvents().get(0).getEvent(), Matchers.is(event)); }