### Question:
CatchupPollingProcess extends LifecycleAdapter { @Override public synchronized void start() { state = TX_PULLING; timer = timerService.create( TX_PULLER_TIMER, Group.PULL_UPDATES, timeout -> onTimeout() ); timer.set( fixedTimeout( txPullIntervalMillis, MILLISECONDS ) ); dbHealth = databaseHealthSupplier.get(); upToDateFuture = new CompletableFuture<>(); } CatchupPollingProcess( LogProvider logProvider, LocalDatabase localDatabase, Suspendable enableDisableOnSoreCopy, CatchUpClient catchUpClient,
                                  UpstreamDatabaseStrategySelector selectionStrategy, TimerService timerService, long txPullIntervalMillis,
                                  BatchingTxApplier applier, Monitors monitors, StoreCopyProcess storeCopyProcess,
                                  Supplier<DatabaseHealth> databaseHealthSupplier, TopologyService topologyService ); @Override synchronized void start(); Future<Boolean> upToDateFuture(); @Override void stop(); State state(); String describeState();  }### Answer:
@Test public void shouldSendPullRequestOnTick() throws Throwable { txPuller.start(); long lastAppliedTxId = 99L; when( txApplier.lastQueuedTxId() ).thenReturn( lastAppliedTxId ); timerService.invoke( TX_PULLER_TIMER ); verify( catchUpClient ).makeBlockingRequest( any( AdvertisedSocketAddress.class ), any( TxPullRequest.class ), any( CatchUpResponseCallback.class ) ); }
@Test public void shouldKeepMakingPullRequestsUntilEndOfStream() throws Throwable { txPuller.start(); long lastAppliedTxId = 99L; when( txApplier.lastQueuedTxId() ).thenReturn( lastAppliedTxId ); when( catchUpClient.<TxStreamFinishedResponse>makeBlockingRequest( any( AdvertisedSocketAddress.class ), any( TxPullRequest.class ), any( CatchUpResponseCallback.class ) ) ).thenReturn( new TxStreamFinishedResponse( CatchupResult.SUCCESS_END_OF_STREAM, 10 ) ); timerService.invoke( TX_PULLER_TIMER ); verify( catchUpClient, times( 1 ) ).makeBlockingRequest( any( AdvertisedSocketAddress.class ), any( TxPullRequest.class ), any( CatchUpResponseCallback.class ) ); }
@Test public void shouldRenewTxPullTimeoutOnSuccessfulTxPulling() throws Throwable { txPuller.start(); when( catchUpClient.makeBlockingRequest( any( AdvertisedSocketAddress.class ), any( TxPullRequest.class ), any( CatchUpResponseCallback.class ) ) ).thenReturn( new TxStreamFinishedResponse( CatchupResult.SUCCESS_END_OF_STREAM, 0 ) ); timerService.invoke( TX_PULLER_TIMER ); assertEquals( 1, timerService.invocationCount( TX_PULLER_TIMER ) ); }