### Question:
DownloadReceiptsStep implements Function<List<Block>, CompletableFuture<List<BlockWithReceipts>>> { @Override public CompletableFuture<List<BlockWithReceipts>> apply(final List<Block> blocks) { final List<BlockHeader> headers = blocks.stream().map(Block::getHeader).collect(toList()); final CompletableFuture<Map<BlockHeader, List<TransactionReceipt>>> getReceipts = GetReceiptsForHeadersTask.forHeaders(ethContext, headers, metricsSystem).run(); final CompletableFuture<List<BlockWithReceipts>> combineWithBlocks = getReceipts.thenApply( receiptsByHeader -> combineBlocksAndReceipts(blocks, receiptsByHeader)); FutureUtils.propagateCancellation(combineWithBlocks, getReceipts); return combineWithBlocks; } DownloadReceiptsStep(final EthContext ethContext, final MetricsSystem metricsSystem); @Override CompletableFuture<List<BlockWithReceipts>> apply(final List<Block> blocks);  }### Answer:
@Test public void shouldDownloadReceiptsForBlocks() { final RespondingEthPeer peer = EthProtocolManagerTestUtil.createPeer(ethProtocolManager, 1000); final List<Block> blocks = asList(block(1), block(2), block(3), block(4)); final CompletableFuture<List<BlockWithReceipts>> result = downloadReceiptsStep.apply(blocks); peer.respond(RespondingEthPeer.blockchainResponder(blockchain)); assertThat(result) .isCompletedWithValue( asList( blockWithReceipts(1), blockWithReceipts(2), blockWithReceipts(3), blockWithReceipts(4))); }