@Test public void testCollectCFGS_AddingCFG(){ instrumentedClasses.add(Integer.class); RawControlFlowGraph realRCFG1 = new RawControlFlowGraph(BotsingTestGenerationContext.getInstance().getClassLoaderForSUT(),Integer.class.getName(),selectedmethod,0); RawControlFlowGraph rcfg1 = Mockito.spy(realRCFG1); BytecodeInstruction stmnt = testingUtils.mockNewStatement(Integer.class.getName(),selectedmethod,1400); Set<BytecodeInstruction> stmntList = new HashSet<>(); stmntList.add(stmnt); GraphPool.getInstance(BotsingTestGenerationContext.getInstance().getClassLoaderForSUT()).registerRawCFG(rcfg1); CUT.collectCFGS(instrumentedClasses); assertEquals(1 ,CUT.cfgs.get(Integer.class.getName()).size()); assertEquals(selectedmethod, CUT.cfgs.get(Integer.class.getName()).get(0).getMethodName()); }
protected void collectCFGS(List<Class> instrumentedClasses) { GraphPool graphPool = GraphPool.getInstance(BotsingTestGenerationContext.getInstance().getClassLoaderForSUT()); for (Class clazz : instrumentedClasses){ Map<String, RawControlFlowGraph> methodsGraphs = graphPool.getRawCFGs(clazz.getName()); if (methodsGraphs != null) { cfgs.put(clazz.getName(),new ArrayList<>()); for (Map.Entry<String, RawControlFlowGraph> entry : methodsGraphs.entrySet()) { RawControlFlowGraph cfg = entry.getValue(); cfgs.get(clazz.getName()).add(cfg); } } else { LOG.warn("The generated control flow graphs for class {} was empty.", clazz); } } }
CFGGenerator { protected void collectCFGS(List<Class> instrumentedClasses) { GraphPool graphPool = GraphPool.getInstance(BotsingTestGenerationContext.getInstance().getClassLoaderForSUT()); for (Class clazz : instrumentedClasses){ Map<String, RawControlFlowGraph> methodsGraphs = graphPool.getRawCFGs(clazz.getName()); if (methodsGraphs != null) { cfgs.put(clazz.getName(),new ArrayList<>()); for (Map.Entry<String, RawControlFlowGraph> entry : methodsGraphs.entrySet()) { RawControlFlowGraph cfg = entry.getValue(); cfgs.get(clazz.getName()).add(cfg); } } else { LOG.warn("The generated control flow graphs for class {} was empty.", clazz); } } } }
CFGGenerator { protected void collectCFGS(List<Class> instrumentedClasses) { GraphPool graphPool = GraphPool.getInstance(BotsingTestGenerationContext.getInstance().getClassLoaderForSUT()); for (Class clazz : instrumentedClasses){ Map<String, RawControlFlowGraph> methodsGraphs = graphPool.getRawCFGs(clazz.getName()); if (methodsGraphs != null) { cfgs.put(clazz.getName(),new ArrayList<>()); for (Map.Entry<String, RawControlFlowGraph> entry : methodsGraphs.entrySet()) { RawControlFlowGraph cfg = entry.getValue(); cfgs.get(clazz.getName()).add(cfg); } } else { LOG.warn("The generated control flow graphs for class {} was empty.", clazz); } } }  }
CFGGenerator { protected void collectCFGS(List<Class> instrumentedClasses) { GraphPool graphPool = GraphPool.getInstance(BotsingTestGenerationContext.getInstance().getClassLoaderForSUT()); for (Class clazz : instrumentedClasses){ Map<String, RawControlFlowGraph> methodsGraphs = graphPool.getRawCFGs(clazz.getName()); if (methodsGraphs != null) { cfgs.put(clazz.getName(),new ArrayList<>()); for (Map.Entry<String, RawControlFlowGraph> entry : methodsGraphs.entrySet()) { RawControlFlowGraph cfg = entry.getValue(); cfgs.get(clazz.getName()).add(cfg); } } else { LOG.warn("The generated control flow graphs for class {} was empty.", clazz); } } }  void generateInterProceduralCFG(); }
CFGGenerator { protected void collectCFGS(List<Class> instrumentedClasses) { GraphPool graphPool = GraphPool.getInstance(BotsingTestGenerationContext.getInstance().getClassLoaderForSUT()); for (Class clazz : instrumentedClasses){ Map<String, RawControlFlowGraph> methodsGraphs = graphPool.getRawCFGs(clazz.getName()); if (methodsGraphs != null) { cfgs.put(clazz.getName(),new ArrayList<>()); for (Map.Entry<String, RawControlFlowGraph> entry : methodsGraphs.entrySet()) { RawControlFlowGraph cfg = entry.getValue(); cfgs.get(clazz.getName()).add(cfg); } } else { LOG.warn("The generated control flow graphs for class {} was empty.", clazz); } } }  void generateInterProceduralCFG();  }