### Question:
MarkCommit implements Action1<CollectionIoEvent<MvccEntity>> { @Override public void call( final CollectionIoEvent<MvccEntity> idIoEvent ) { final MvccEntity entity = idIoEvent.getEvent(); MvccValidationUtils.verifyMvccEntityOptionalEntity( entity ); final Id entityId = entity.getId(); final UUID version = entity.getVersion(); final ApplicationScope applicationScope = idIoEvent.getEntityCollection(); logger.debug("Inserting tombstone for entity {} at version {}", entityId, version ); final MvccLogEntry startEntry = new MvccLogEntryImpl( entityId, version, Stage.COMMITTED, MvccLogEntry.State.DELETED ); final MutationBatch entityStateBatch = logStrat.write( applicationScope, startEntry ); try { final MutationBatch entityBatch = entityStrat.mark( applicationScope, entityId, version ); entityStateBatch.mergeShallow( entityBatch ); entityStateBatch.execute(); } catch ( ConnectionException e ) { throw new RuntimeException( "Unable to mark entry as deleted" ); } } @Inject  MarkCommit( final MvccLogEntrySerializationStrategy logStrat,
                       final MvccEntitySerializationStrategy entityStrat,
                       final UniqueValueSerializationStrategy uniqueValueStrat,
                       final SerializationFig serializationFig,
                       final ActorSystemFig actorSystemFig,
                       final UniqueValuesFig uniqueValuesFig,
                       final UniqueValuesService uniqueValuesService,
                       final Keyspace keyspace ); @Override void call( final CollectionIoEvent<MvccEntity> idIoEvent );  }### Answer:
@Inject @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 UniqueValueSerializationStrategy uniqueValueStrategy = mock( UniqueValueSerializationStrategy.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 ); 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 ); }