### Question:
WriteCommit implements Func1<CollectionIoEvent<MvccEntity>, CollectionIoEvent<MvccEntity>> { @Override public CollectionIoEvent<MvccEntity> call( final CollectionIoEvent<MvccEntity> ioEvent ) { return confirmUniqueFields( ioEvent ); } @Inject  WriteCommit( final MvccLogEntrySerializationStrategy logStrat,
                        final MvccEntitySerializationStrategy entryStrat,
                        final UniqueValueSerializationStrategy uniqueValueStrat,
                        final ActorSystemFig actorSystemFig,
                        final UniqueValuesFig uniqueValuesFig,
                        final UniqueValuesService akkaUvService,
                        final Session session ); @Override CollectionIoEvent<MvccEntity> call( final CollectionIoEvent<MvccEntity> ioEvent );  }### Answer:
@Test public void testStartStage() throws Exception { final ApplicationScope context = mock( ApplicationScope.class ); final Session session = mock(Session.class); final MvccLogEntrySerializationStrategy logStrategy = mock( MvccLogEntrySerializationStrategy.class ); final ArgumentCaptor<MvccLogEntry> logEntry = ArgumentCaptor.forClass( MvccLogEntry.class ); final MutationBatch logMutation = mock( MutationBatch.class ); when( logStrategy.write( same( context ), logEntry.capture() ) ).thenReturn( logMutation ); final MvccEntitySerializationStrategy mvccEntityStrategy = mock( MvccEntitySerializationStrategy.class ); final ArgumentCaptor<MvccEntity> mvccEntityCapture = ArgumentCaptor.forClass( MvccEntity.class ); final MutationBatch mvccEntityMutation = mock( MutationBatch.class ); when( mvccEntityStrategy.write( same( context ), mvccEntityCapture.capture() ) ) .thenReturn( mvccEntityMutation ); final Entity entity = TestEntityGenerator.generateEntity(); final MvccEntity mvccEntityInput = TestEntityGenerator.fromEntity( entity ); final UniqueValueSerializationStrategy uniqueValueStrategy = mock( UniqueValueSerializationStrategy.class ); WriteCommit newStage = new WriteCommit( logStrategy, mvccEntityStrategy, uniqueValueStrategy, null, null, null, session ); Entity result = newStage.call( new CollectionIoEvent<MvccEntity>( context, mvccEntityInput ) ).getEvent().getEntity().get(); MvccLogEntry entry = logEntry.getValue(); assertEquals( "id correct", entity.getId(), entry.getEntityId() ); assertEquals( "version was not correct", entity.getVersion(), entry.getVersion() ); assertEquals( "EventStage is correct", Stage.COMMITTED, entry.getStage() ); MvccEntity written = mvccEntityCapture.getValue(); assertEquals( "version was correct", entity.getVersion(), written.getVersion() ); assertSame( "Entity correct", entity, written.getEntity().get() ); assertSame( "Entity Id is correct", entity.getId(), written.getId() ); assertSame( "Entity came from result", entity, result ); }