@Test public void testGetLineCoverageFitness_coveredLine() throws IOException { BufferedReader obj = 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(obj).when(target).readFromFile(anyString()); target.setup("", 2); Map<Integer, Integer> lineCoverage = new HashMap<>(); lineCoverage.put(10, 1); Map<String, Map<Integer, Integer>> methodCoverage = new HashMap<>(); methodCoverage.put("method2", lineCoverage); ExecutionTrace executionTrace = new ExecutionTraceImpl(); Map<String, Map<String, Map<Integer, Integer>>> classCoverage = executionTrace.getCoverageData(); classCoverage.put("eu.stamp.ClassB", methodCoverage); ExecutionResult result = new ExecutionResult(new DefaultTestCase()); result.setTrace(executionTrace); double fitness = calculator.getLineCoverageFitness(result, target, 10); assertEquals(0, fitness, 0.0001); }
public double getLineCoverageFitness( ExecutionResult result , int lineNumber) { StackTrace trace = targetCrash; return getLineCoverageFitness(result, trace, lineNumber); }
CrashCoverageFitnessCalculator { public double getLineCoverageFitness( ExecutionResult result , int lineNumber) { StackTrace trace = targetCrash; return getLineCoverageFitness(result, trace, lineNumber); } }
CrashCoverageFitnessCalculator { public double getLineCoverageFitness( ExecutionResult result , int lineNumber) { StackTrace trace = targetCrash; return getLineCoverageFitness(result, trace, lineNumber); } CrashCoverageFitnessCalculator(StackTrace crash); }
CrashCoverageFitnessCalculator { public double getLineCoverageFitness( ExecutionResult result , int lineNumber) { StackTrace trace = targetCrash; return getLineCoverageFitness(result, trace, lineNumber); } CrashCoverageFitnessCalculator(StackTrace crash); double getLineCoverageFitness( ExecutionResult result , int lineNumber); double getLineCoverageForFrame( ExecutionResult result, int frameLevel); double calculateFrameSimilarity( StackTraceElement[] trace); double getFrameDistance(StackTraceElement targetFrame, StackTraceElement generatedFrame); }
CrashCoverageFitnessCalculator { public double getLineCoverageFitness( ExecutionResult result , int lineNumber) { StackTrace trace = targetCrash; return getLineCoverageFitness(result, trace, lineNumber); } CrashCoverageFitnessCalculator(StackTrace crash); double getLineCoverageFitness( ExecutionResult result , int lineNumber); double getLineCoverageForFrame( ExecutionResult result, int frameLevel); double calculateFrameSimilarity( StackTraceElement[] trace); double getFrameDistance(StackTraceElement targetFrame, StackTraceElement generatedFrame);  }