### Question:
BotsingRawControlFlowGraph extends RawControlFlowGraph { @Override public BasicBlock determineBasicBlockFor(BytecodeInstruction instruction) { if (instruction == null) { throw new IllegalArgumentException("The given bytecode instruction is null"); } List<BytecodeInstruction> blockNodes = new ArrayList<BytecodeInstruction>(); blockNodes.add(instruction); Set<BytecodeInstruction> handledChildren = new HashSet<BytecodeInstruction>(); Set<BytecodeInstruction> handledParents = new HashSet<BytecodeInstruction>(); Queue<BytecodeInstruction> queue = new LinkedList<BytecodeInstruction>(); queue.add(instruction); while (!queue.isEmpty()) { BytecodeInstruction currentInstruction = queue.poll(); if (outDegreeOf(currentInstruction) == 1) { BytecodeInstruction child = getChildren(currentInstruction).iterator().next(); if (!blockNodes.contains(child) && !handledChildren.contains(child)) { handledChildren.add(child); if (inDegreeOf(child) < 2) { blockNodes.add(blockNodes.indexOf(currentInstruction) + 1, child); queue.add(child); } } } if (inDegreeOf(currentInstruction) == 1) { BytecodeInstruction parent = getParents(currentInstruction).iterator().next(); if (!blockNodes.contains(parent) && !handledParents.contains(parent)) { handledParents.add(parent); if (outDegreeOf(parent) < 2) { blockNodes.add(blockNodes.indexOf(currentInstruction), parent); queue.add(parent); } } } } InterproceduralBasicBlock basicBlock = new InterproceduralBasicBlock(this.getClassLoader(),this.className,this.methodName,blockNodes); LOG.debug("Created basic block: {}",basicBlock.toString()); return basicBlock; } BotsingRawControlFlowGraph(ClassLoader classLoader, String className, String methodName, int access); void clone(RawControlFlowGraph cfg); void addInterProceduralEdge(BytecodeInstruction src, BytecodeInstruction target, Set<BytecodeInstruction> targetGraphExitPoints); void addGeneralEntryPoint(BytecodeInstruction src); @Override BasicBlock determineBasicBlockFor(BytecodeInstruction instruction); void cloneAsNewNode(BytecodeInstruction source, RawControlFlowGraph cfg); void addEdges(BytecodeInstruction src,BytecodeInstruction target, boolean isException);  }### Answer:
@Test public void testNullBasicBlock(){ RawControlFlowGraph realRCFG1 = new BotsingRawControlFlowGraph(BotsingTestGenerationContext.getInstance().getClassLoaderForSUT(),"testClass","testMethod",0); try{ realRCFG1.determineBasicBlockFor(null); }catch(IllegalArgumentException e){ assertTrue(e.getMessage().contains("The given bytecode instruction is null")); } }
@Test public void testBasicBlock(){ RawControlFlowGraph realRCFG1 = new BotsingRawControlFlowGraph(BotsingTestGenerationContext.getInstance().getClassLoaderForSUT(),"testClass","testMethod",0); RawControlFlowGraph rcfg1 = Mockito.spy(realRCFG1); BytecodeInstruction mainStmnt = testingUtils.mockNewStatement(className,"reverse()"); BytecodeInstruction childStmnt = testingUtils.mockNewStatement(className,"reverse()"); BytecodeInstruction parentStmnt = testingUtils.mockNewStatement(className,"reverse()"); Mockito.doReturn(1).when(rcfg1).outDegreeOf(mainStmnt); Set<BytecodeInstruction> childSet = new HashSet<>(); childSet.add(childStmnt); Mockito.doReturn(childSet).when(rcfg1).getChildren(mainStmnt); Mockito.doReturn(1).when(rcfg1).inDegreeOf(mainStmnt); Set<BytecodeInstruction> parentSet = new HashSet<>(); parentSet.add(parentStmnt); Mockito.doReturn(parentSet).when(rcfg1).getParents(mainStmnt); rcfg1.determineBasicBlockFor(mainStmnt); }