### Question:
GuidedSearchUtility { public BytecodeInstruction collectPublicCalls(StackTrace trace){ Set<BytecodeInstruction> result = new HashSet<>(); getPublicCalls(trace.getTargetClass(), trace.getTargetLine()); boolean nonPrivateFrameFound = false; int currentTargetFramelevel = trace.getTargetFrameLevel(); while(!nonPrivateFrameFound){ StackTraceElement currentTargetFrame = trace.getAllFrames().get(currentTargetFramelevel-1); for(BytecodeInstruction bc: publicCallsBC){ if(bc.getClassName().equals(currentTargetFrame.getClassName()) && cleanMethodName(bc.getMethodName()).equals(currentTargetFrame.getMethodName()) && bc.getLineNumber() == currentTargetFrame.getLineNumber()){ result.add(bc); nonPrivateFrameFound=true; trace.updatePublicTargetFrameLevel(currentTargetFramelevel); break; } } currentTargetFramelevel++; } if(result.size() != 1){ throw new IllegalStateException("There should be only one target bytecode instruction!"); } return (BytecodeInstruction) result.toArray()[0]; }  BytecodeInstruction collectPublicCalls(StackTrace trace); boolean includesPublicCall(T individual, Set<GenericAccessibleObject<?>> publicCalls); public Set<BytecodeInstruction> publicCallsBC; }### Answer:
@Test public void testGeneralCollector() throws FileNotFoundException { BytecodeInstruction stmt = Mockito.mock(BytecodeInstruction.class); Mockito.doReturn("java.lang.Integer").when(stmt).getClassName(); Mockito.doReturn("reverse()").when(stmt).getMethodName(); Mockito.doReturn(20).when(stmt).getLineNumber(); ActualControlFlowGraph actualCFG = mockActualControlFlowGraph(stmt, true); Mockito.doReturn(actualCFG).when(stmt).getActualCFG(); BytecodeInstructionPool.getInstance(TestGenerationContext.getInstance().getClassLoaderForSUT()).registerInstruction(stmt); BufferedReader givenStackTrace = new BufferedReader(new StringReader("java.lang.IllegalArgumentException:\n" + "\tat java.lang.Integer.bitCount(Integer.java:10)\n" + "\tat java.lang.Integer.reverse(Integer.java:20)")); StackTrace trace= Mockito.spy(new StackTrace()); Mockito.doReturn(givenStackTrace).when(trace).readFromFile(anyString()); trace.setup("", 2); GuidedSearchUtility utility = new GuidedSearchUtility(); utility.collectPublicCalls(trace); }