### Question:
ChainManager { public boolean checkIsBeforeOrphanChainAndAdd(Block block) { BlockHeader header = block.getHeader(); boolean success = false; for(ChainContainer chainContainer : orphanChains) { Chain chain = chainContainer.getChain(); if(header.getHash().equals(chain.getStartBlockHeader().getPreHash())) { success = true; chain.addPreBlock(block); } } return success; } ChainManager(); void newOrphanChain(Block block); boolean checkIsBeforeOrphanChainAndAdd(Block block); boolean checkIsAfterOrphanChainAndAdd(Block block); long getBestBlockHeight(); void clear(); ChainContainer getMasterChain(); void setMasterChain(ChainContainer masterChain); List<ChainContainer> getChains(); Block getBestBlock(); List<ChainContainer> getOrphanChains();  }### Answer:
@Test public void testCheckIsBeforeOrphanChainAndAdd() { testGetBestBlockHeight(); Block block = createBlock(); Block block1 = createBlock(); block1.getHeader().setHeight(1L); block1.getHeader().setPreHash(block.getHeader().getHash()); ChainContainer orphanChain = new ChainContainer(new Chain()); orphanChain.getChain().addBlock(block1); chainManager.getOrphanChains().add(orphanChain); assertEquals(1, chainManager.getOrphanChains().size()); boolean success = chainManager.checkIsBeforeOrphanChainAndAdd(block); assertTrue(success); }