@Test public void testNullInstumentedClassInGenerateInterProceduralCFG() throws FileNotFoundException { BufferedReader givenStackTrace = new BufferedReader(new StringReader("java.lang.IllegalArgumentException:\n" + "\tat eu.stamp.ClassA.method2(ClassA.java:10)\n" + "\tat eu.stamp.ClassB.method1(ClassB.java:20)")); StackTrace target = Mockito.spy(new StackTrace()); Mockito.doReturn(givenStackTrace).when(target).readFromFile(anyString()); target.setup("", 2); CrashProperties.getInstance().setupStackTrace(target); try { CUT.generateInterProceduralCFG(); }catch(IllegalArgumentException e){ assertTrue(e.getMessage().contains("There is no instrumented classes")); } }
public void generateInterProceduralCFG() { int numberOfStackTraces = CrashProperties.getInstance().getCrashesSize(); List<String> interestingClasses; for (int crashIndex=0; crashIndex<numberOfStackTraces;crashIndex++){ interestingClasses = CrashProperties.getInstance().getTargetClasses(crashIndex); List<Class> instrumentedClasses = classInstrumenter.instrumentClasses(interestingClasses,interestingClasses.get(interestingClasses.size()-1)); if(!instrumentedClasses.isEmpty()){ collectCFGS(instrumentedClasses); }else{ throw new IllegalArgumentException("There is no instrumented classes!"); } generateRawGraph(crashIndex); actualInterProceduralGraph = new BotsingActualControlFlowGraph(rawInterProceduralGraph); GraphPool.getInstance(BotsingTestGenerationContext.getInstance().getClassLoaderForSUT()).registerActualCFG(actualInterProceduralGraph); controlDependenceInterProceduralGraph = new ControlDependenceGraph(actualInterProceduralGraph); GraphPool.getInstance(BotsingTestGenerationContext.getInstance().getClassLoaderForSUT()).registerControlDependence(controlDependenceInterProceduralGraph); logGeneratedCDG(); } }
CFGGenerator { public void generateInterProceduralCFG() { int numberOfStackTraces = CrashProperties.getInstance().getCrashesSize(); List<String> interestingClasses; for (int crashIndex=0; crashIndex<numberOfStackTraces;crashIndex++){ interestingClasses = CrashProperties.getInstance().getTargetClasses(crashIndex); List<Class> instrumentedClasses = classInstrumenter.instrumentClasses(interestingClasses,interestingClasses.get(interestingClasses.size()-1)); if(!instrumentedClasses.isEmpty()){ collectCFGS(instrumentedClasses); }else{ throw new IllegalArgumentException("There is no instrumented classes!"); } generateRawGraph(crashIndex); actualInterProceduralGraph = new BotsingActualControlFlowGraph(rawInterProceduralGraph); GraphPool.getInstance(BotsingTestGenerationContext.getInstance().getClassLoaderForSUT()).registerActualCFG(actualInterProceduralGraph); controlDependenceInterProceduralGraph = new ControlDependenceGraph(actualInterProceduralGraph); GraphPool.getInstance(BotsingTestGenerationContext.getInstance().getClassLoaderForSUT()).registerControlDependence(controlDependenceInterProceduralGraph); logGeneratedCDG(); } } }
CFGGenerator { public void generateInterProceduralCFG() { int numberOfStackTraces = CrashProperties.getInstance().getCrashesSize(); List<String> interestingClasses; for (int crashIndex=0; crashIndex<numberOfStackTraces;crashIndex++){ interestingClasses = CrashProperties.getInstance().getTargetClasses(crashIndex); List<Class> instrumentedClasses = classInstrumenter.instrumentClasses(interestingClasses,interestingClasses.get(interestingClasses.size()-1)); if(!instrumentedClasses.isEmpty()){ collectCFGS(instrumentedClasses); }else{ throw new IllegalArgumentException("There is no instrumented classes!"); } generateRawGraph(crashIndex); actualInterProceduralGraph = new BotsingActualControlFlowGraph(rawInterProceduralGraph); GraphPool.getInstance(BotsingTestGenerationContext.getInstance().getClassLoaderForSUT()).registerActualCFG(actualInterProceduralGraph); controlDependenceInterProceduralGraph = new ControlDependenceGraph(actualInterProceduralGraph); GraphPool.getInstance(BotsingTestGenerationContext.getInstance().getClassLoaderForSUT()).registerControlDependence(controlDependenceInterProceduralGraph); logGeneratedCDG(); } }  }
CFGGenerator { public void generateInterProceduralCFG() { int numberOfStackTraces = CrashProperties.getInstance().getCrashesSize(); List<String> interestingClasses; for (int crashIndex=0; crashIndex<numberOfStackTraces;crashIndex++){ interestingClasses = CrashProperties.getInstance().getTargetClasses(crashIndex); List<Class> instrumentedClasses = classInstrumenter.instrumentClasses(interestingClasses,interestingClasses.get(interestingClasses.size()-1)); if(!instrumentedClasses.isEmpty()){ collectCFGS(instrumentedClasses); }else{ throw new IllegalArgumentException("There is no instrumented classes!"); } generateRawGraph(crashIndex); actualInterProceduralGraph = new BotsingActualControlFlowGraph(rawInterProceduralGraph); GraphPool.getInstance(BotsingTestGenerationContext.getInstance().getClassLoaderForSUT()).registerActualCFG(actualInterProceduralGraph); controlDependenceInterProceduralGraph = new ControlDependenceGraph(actualInterProceduralGraph); GraphPool.getInstance(BotsingTestGenerationContext.getInstance().getClassLoaderForSUT()).registerControlDependence(controlDependenceInterProceduralGraph); logGeneratedCDG(); } }  void generateInterProceduralCFG(); }
CFGGenerator { public void generateInterProceduralCFG() { int numberOfStackTraces = CrashProperties.getInstance().getCrashesSize(); List<String> interestingClasses; for (int crashIndex=0; crashIndex<numberOfStackTraces;crashIndex++){ interestingClasses = CrashProperties.getInstance().getTargetClasses(crashIndex); List<Class> instrumentedClasses = classInstrumenter.instrumentClasses(interestingClasses,interestingClasses.get(interestingClasses.size()-1)); if(!instrumentedClasses.isEmpty()){ collectCFGS(instrumentedClasses); }else{ throw new IllegalArgumentException("There is no instrumented classes!"); } generateRawGraph(crashIndex); actualInterProceduralGraph = new BotsingActualControlFlowGraph(rawInterProceduralGraph); GraphPool.getInstance(BotsingTestGenerationContext.getInstance().getClassLoaderForSUT()).registerActualCFG(actualInterProceduralGraph); controlDependenceInterProceduralGraph = new ControlDependenceGraph(actualInterProceduralGraph); GraphPool.getInstance(BotsingTestGenerationContext.getInstance().getClassLoaderForSUT()).registerControlDependence(controlDependenceInterProceduralGraph); logGeneratedCDG(); } }  void generateInterProceduralCFG();  }