PhpCfgEndBlock extends PhpCfgBlock { @Override public void replaceSuccessors(Map<PhpCfgBlock, PhpCfgBlock> replacements) { throw new UnsupportedOperationException("Cannot replace successors of end block"); }  @Override ImmutableSet<CfgBlock> successors(); @Override void addElement(Tree element); @Override void replaceSuccessors(Map<PhpCfgBlock, PhpCfgBlock> replacements); @Override String toString();  }
@Test(expected = UnsupportedOperationException.class) public void cannot_replace_successors() { PhpCfgEndBlock endBlock = new PhpCfgEndBlock(); Map<PhpCfgBlock, PhpCfgBlock> map = new HashMap<>(); map.put(endBlock, endBlock); endBlock.replaceSuccessors(map); }