### Question:
EthHashMiningCoordinator extends AbstractMiningCoordinator<EthHashBlockMiner> implements BlockAddedObserver { @Override public Optional<Long> hashesPerSecond() { if (sealerHashRate.size() <= 0) { return localHashesPerSecond(); } else { return remoteHashesPerSecond(); } } EthHashMiningCoordinator(
      final Blockchain blockchain,
      final EthHashMinerExecutor executor,
      final SyncState syncState,
      final int remoteSealersLimit,
      final long remoteSealersTimeToLive); @Override void setCoinbase(final Address coinbase); void setStratumMiningEnabled(final boolean stratumMiningEnabled); @Override void onResumeMining(); @Override void onPauseMining(); @Override Optional<Long> hashesPerSecond(); @Override boolean submitHashRate(final String id, final Long hashrate); @Override Optional<EthHashSolverInputs> getWorkDefinition(); @Override boolean submitWork(final EthHashSolution solution);  }### Answer:
@Test @SuppressWarnings("unchecked") public void reportedHashRateIsCachedIfNoCurrentDataInMiner() { final Optional<Long> hashRate1 = Optional.of(10L); final Optional<Long> hashRate2 = Optional.empty(); final Optional<Long> hashRate3 = Optional.of(20L); when(miner.getHashesPerSecond()).thenReturn(hashRate1, hashRate2, hashRate3); when(executor.startAsyncMining(any(), any(), any())).thenReturn(Optional.of(miner)); final EthHashMiningCoordinator miningCoordinator = new EthHashMiningCoordinator( executionContext.getBlockchain(), executor, syncState, DEFAULT_REMOTE_SEALERS_LIMIT, DEFAULT_REMOTE_SEALERS_TTL); miningCoordinator.enable(); miningCoordinator.start(); assertThat(miningCoordinator.hashesPerSecond()).isEqualTo(hashRate1); assertThat(miningCoordinator.hashesPerSecond()).isEqualTo(hashRate1); assertThat(miningCoordinator.hashesPerSecond()).isEqualTo(hashRate3); }