### Question:
BlockChainImpl implements Blockchain { @Override public Block getBlockByNumber(long number) { return blockStore.getChainBlockByNumber(number); } BlockChainImpl(Repository repository,
                          BlockStore blockStore,
                          ReceiptStore receiptStore,
                          TransactionPool transactionPool,
                          EthereumListener listener,
                          BlockValidator blockValidator,
                          boolean flushEnabled,
                          int flushNumberOfBlocks,
                          BlockExecutor blockExecutor); @Override Repository getRepository(); @Override BlockStore getBlockStore(); EthereumListener getListener(); void setListener(EthereumListener listener); BlockValidator getBlockValidator(); @VisibleForTesting void setBlockValidator(BlockValidator validator); @Override long getSize(); @Override ImportResult tryToConnect(Block block); @Override void suspendProcess(); @Override void resumeProcess(); @Override BlockChainStatus getStatus(); @Override void setStatus(Block block, BlockDifficulty totalDifficulty); @Override Block getBlockByHash(byte[] hash); @Override void setExitOn(long exitOn); @Override boolean isBlockExist(byte[] hash); @Override List<BlockHeader> getListOfHeadersStartFrom(BlockIdentifier identifier, int skip, int limit, boolean reverse); @Override List<byte[]> getListOfBodiesByHashes(List<byte[]> hashes); @Override List<Block> getBlocksByNumber(long number); @Override List<BlockInformation> getBlocksInformationByNumber(long number); @Override boolean hasBlockInSomeBlockchain(@Nonnull final byte[] hash); @Override void removeBlocksByNumber(long number); @Override Block getBlockByNumber(long number); @Override void setBestBlock(Block block); @Override Block getBestBlock(); void setNoValidation(boolean noValidation); @Override TransactionInfo getTransactionInfo(byte[] hash); @Override void close(); @Override BlockDifficulty getTotalDifficulty(); @Override void setTotalDifficulty(BlockDifficulty totalDifficulty); @Override @VisibleForTesting byte[] getBestBlockHash(); @Override void setBlockRecorder(BlockRecorder blockRecorder); static byte[] calcTxTrie(List<Transaction> transactions); static byte[] calcReceiptsTrie(List<TransactionReceipt> receipts);  }### Answer:
@Test public void getBlockByNumber() { BlockChainImpl blockChain = createBlockChain(); Block genesis = getGenesisBlock(blockChain); BlockGenerator blockGenerator = new BlockGenerator(); Block block1 = blockGenerator.createChildBlock(genesis); Block block2 = blockGenerator.createChildBlock(block1); Block block3 = blockGenerator.createChildBlock(block2); Assert.assertEquals(ImportResult.IMPORTED_BEST, blockChain.tryToConnect(genesis)); Assert.assertEquals(ImportResult.IMPORTED_BEST, blockChain.tryToConnect(block1)); Assert.assertEquals(ImportResult.IMPORTED_BEST, blockChain.tryToConnect(block2)); Assert.assertEquals(ImportResult.IMPORTED_BEST, blockChain.tryToConnect(block3)); Block block = blockChain.getBlockByNumber(0); Assert.assertNotNull(block); Assert.assertEquals(0, block.getNumber()); Assert.assertEquals(genesis.getHash(), block.getHash()); block = blockChain.getBlockByNumber(1); Assert.assertNotNull(block); Assert.assertEquals(1, block.getNumber()); Assert.assertEquals(block1.getHash(), block.getHash()); block = blockChain.getBlockByNumber(2); Assert.assertNotNull(block); Assert.assertEquals(2, block.getNumber()); Assert.assertEquals(block2.getHash(), block.getHash()); block = blockChain.getBlockByNumber(3); Assert.assertNotNull(block); Assert.assertEquals(3, block.getNumber()); Assert.assertEquals(block3.getHash(), block.getHash()); block = blockChain.getBlockByNumber(4); Assert.assertNull(block); }