### Question:
TrailingPeerLimiter implements BlockAddedObserver { @Override public void onBlockAdded(final BlockAddedEvent event) { if (event.isNewCanonicalHead() && event.getBlock().getHeader().getNumber() % RECHECK_PEERS_WHEN_BLOCK_NUMBER_MULTIPLE_OF == 0) { enforceTrailingPeerLimit(); } } TrailingPeerLimiter(
      final EthPeers ethPeers,
      final Supplier<TrailingPeerRequirements> trailingPeerRequirementsCalculator); void enforceTrailingPeerLimit(); @Override void onBlockAdded(final BlockAddedEvent event);  }### Answer:
@Test public void shouldRecheckTrailingPeersWhenBlockAddedThatIsMultipleOf100() { final EthPeer ethPeer1 = addPeerWithEstimatedHeight(1); addPeerWithEstimatedHeight(3); addPeerWithEstimatedHeight(2); final BlockAddedEvent blockAddedEvent = BlockAddedEvent.createForHeadAdvancement( new Block( new BlockHeaderTestFixture().number(500).buildHeader(), new BlockBody(emptyList(), emptyList())), Collections.emptyList(), Collections.emptyList()); trailingPeerLimiter.onBlockAdded(blockAddedEvent); assertDisconnections(ethPeer1); }
@Test public void shouldNotRecheckTrailingPeersWhenBlockAddedIsNotAMultipleOf100() { addPeerWithEstimatedHeight(1); addPeerWithEstimatedHeight(3); addPeerWithEstimatedHeight(2); final BlockAddedEvent blockAddedEvent = BlockAddedEvent.createForHeadAdvancement( new Block( new BlockHeaderTestFixture().number(599).buildHeader(), new BlockBody(emptyList(), emptyList())), Collections.emptyList(), Collections.emptyList()); trailingPeerLimiter.onBlockAdded(blockAddedEvent); assertDisconnections(); }