### Question:
RaftMachine implements LeaderLocator, CoreMetaData { public synchronized ConsensusOutcome handle( RaftMessages.RaftMessage incomingMessage ) throws IOException { Outcome outcome = currentRole.handler.handle( incomingMessage, state, log ); boolean newLeaderWasElected = leaderChanged( outcome, state.leader() ); state.update( outcome ); sendMessages( outcome ); handleTimers( outcome ); handleLogShipping( outcome ); driveMembership( outcome ); volatileLeader.set( outcome.getLeader() ); if ( newLeaderWasElected ) { notifyLeaderChanges( outcome ); } return outcome; } RaftMachine( MemberId myself, StateStorage<TermState> termStorage, StateStorage<VoteState> voteStorage, RaftLog entryLog,
            LeaderAvailabilityTimers leaderAvailabilityTimers, Outbound<MemberId,RaftMessages.RaftMessage> outbound, LogProvider logProvider,
            RaftMembershipManager membershipManager, RaftLogShippingManager logShipping, InFlightCache inFlightCache, boolean refuseToBecomeLeader,
            boolean supportPreVoting, Monitors monitors ); synchronized void postRecoveryActions(); synchronized void stopTimers(); void triggerElection( Clock clock ); void panic(); synchronized RaftCoreState coreState(); synchronized void installCoreState( RaftCoreState coreState ); synchronized void setTargetMembershipSet( Set<MemberId> targetMembers ); @Override MemberId getLeader(); @Override synchronized void registerListener( LeaderListener listener ); @Override synchronized void unregisterListener( LeaderListener listener ); synchronized ExposedRaftState state(); synchronized ConsensusOutcome handle( RaftMessages.RaftMessage incomingMessage ); @Override boolean isLeader(); Role currentRole(); MemberId identity(); RaftLogShippingManager logShippingManager(); @Override String toString(); long term(); Set<MemberId> votingMembers(); Set<MemberId> replicationMembers();  }### Answer:
@Test public void shouldPersistAtSpecifiedLogIndex() throws Exception { FakeClock fakeClock = Clocks.fakeClock(); OnDemandTimerService timerService = new OnDemandTimerService( fakeClock ); RaftMachine raft = new RaftMachineBuilder( myself, 3, RaftTestMemberSetBuilder.INSTANCE ) .timerService( timerService ) .clock( fakeClock ) .raftLog( raftLog ) .build(); raftLog.append( new RaftLogEntry( 0, new MemberIdSet( asSet( myself, member1, member2 ) ) ) ); raft.handle( appendEntriesRequest().from( member1 ).prevLogIndex( 0 ).prevLogTerm( 0 ).leaderTerm( 0 ) .logEntry( new RaftLogEntry( 0, data1 ) ).build()); assertEquals( 1, raftLog.appendIndex() ); assertEquals( data1, readLogEntry( raftLog, 1 ).content() ); }