### Question:
FullSyncDownloader { public TrailingPeerRequirements calculateTrailingPeerRequirements() { return syncState.isInSync() ? TrailingPeerRequirements.UNRESTRICTED : new TrailingPeerRequirements( protocolContext.getBlockchain().getChainHeadBlockNumber(), syncConfig.getMaxTrailingPeers()); } FullSyncDownloader(
      final SynchronizerConfiguration syncConfig,
      final ProtocolSchedule protocolSchedule,
      final ProtocolContext protocolContext,
      final EthContext ethContext,
      final SyncState syncState,
      final MetricsSystem metricsSystem); void start(); void stop(); TrailingPeerRequirements calculateTrailingPeerRequirements();  }### Answer:
@Test public void shouldLimitTrailingPeersWhenBehindChain() { localBlockchainSetup.importFirstBlocks(2); final int maxTailingPeers = 5; final FullSyncDownloader synchronizer = downloader(SynchronizerConfiguration.builder().maxTrailingPeers(maxTailingPeers).build()); final RespondingEthPeer bestPeer = EthProtocolManagerTestUtil.createPeer(ethProtocolManager, 100); syncState.setSyncTarget(bestPeer.getEthPeer(), localBlockchain.getChainHeadHeader()); final TrailingPeerRequirements expected = new TrailingPeerRequirements(localBlockchain.getChainHeadBlockNumber(), maxTailingPeers); assertThat(synchronizer.calculateTrailingPeerRequirements()).isEqualTo(expected); }
@Test public void shouldNotLimitTrailingPeersWhenInSync() { localBlockchainSetup.importFirstBlocks(2); final int maxTailingPeers = 5; final FullSyncDownloader synchronizer = downloader(SynchronizerConfiguration.builder().maxTrailingPeers(maxTailingPeers).build()); final RespondingEthPeer bestPeer = EthProtocolManagerTestUtil.createPeer(ethProtocolManager, 2); syncState.setSyncTarget(bestPeer.getEthPeer(), localBlockchain.getChainHeadHeader()); assertThat(synchronizer.calculateTrailingPeerRequirements()) .isEqualTo(TrailingPeerRequirements.UNRESTRICTED); }