### Question:
NotifyingPersistenceDecorator implements EventStorePersistence { @Override public void persistChanges(ChangeSet changeSet) throws ConcurrencyException, DuplicateCommitException { persistence.persistChanges(changeSet); notifier.notifyListeners(changeSet); } NotifyingPersistenceDecorator(
            EventStorePersistence persistence,
            EventStoreCommitNotifier notifier); @Override boolean existsStream(String bucketId, String streamId); @Override Iterator<ChangeSet> allChanges(String bucketId); @Override Iterator<ChangeSet> getFrom(String bucketId, String streamId, long minVersion, long maxVersion); @Override void persistChanges(ChangeSet changeSet);  }### Answer:
@Test public void test_persistChanges() throws DuplicateCommitException { NotifyingPersistenceDecorator decorator = new NotifyingPersistenceDecorator( this, new TestNotifier()); assertNull(this.persistedChangeset); assertTrue(!this.received); ChangeSet cs = new TestChangeSet("TEST_BUCKET", "blabla"); try { decorator.persistChanges(cs); } catch (ConcurrencyException e) { } assertTrue(this.received); assertEquals(this.persistedChangeset, cs); }
@Test public void test_no_notification_on_exception() throws DuplicateCommitException { NotifyingPersistenceDecorator decorator = new NotifyingPersistenceDecorator( this, new TestNotifier()); assertNull(this.persistedChangeset); assertTrue(!this.received); try { decorator.persistChanges(null); fail("Should have failed by now"); } catch (ConcurrencyException e) { } assertTrue(!this.received); }