@Test public void testGetTargetException() { ArrayList<StackTraceElement> stackTrace = new ArrayList<StackTraceElement>(); stackTrace.add(new StackTraceElement("eu.stamp.ClassA", "method2", "ClassA", 10)); stackTrace.add(new StackTraceElement("eu.stamp.ClassB", "method1", "ClassB", 20)); StackTrace trace = Mockito.mock(StackTrace.class); Mockito.when(trace.getNumberOfFrames()).thenReturn(2); Mockito.when(trace.getFrames()).thenReturn(stackTrace); CrashProperties.getInstance().setupStackTrace(trace); Throwable target = CrashProperties.getInstance().getTargetException(0); assertArrayEquals(target.getStackTrace(), stackTrace.toArray()); }
public Throwable getTargetException(int crashIndex) { if (crashes.size() <= crashIndex) { throw new IndexOutOfBoundsException("The given index for crashes is out of bounds"); } StackTraceElement[] stackArray = new StackTraceElement[crashes.get(crashIndex).getNumberOfFrames()]; stackArray = crashes.get(crashIndex).getFrames().toArray(stackArray); Throwable targetException = new Exception(); targetException.setStackTrace(stackArray); return targetException; }
CrashProperties { public Throwable getTargetException(int crashIndex) { if (crashes.size() <= crashIndex) { throw new IndexOutOfBoundsException("The given index for crashes is out of bounds"); } StackTraceElement[] stackArray = new StackTraceElement[crashes.get(crashIndex).getNumberOfFrames()]; stackArray = crashes.get(crashIndex).getFrames().toArray(stackArray); Throwable targetException = new Exception(); targetException.setStackTrace(stackArray); return targetException; } }
CrashProperties { public Throwable getTargetException(int crashIndex) { if (crashes.size() <= crashIndex) { throw new IndexOutOfBoundsException("The given index for crashes is out of bounds"); } StackTraceElement[] stackArray = new StackTraceElement[crashes.get(crashIndex).getNumberOfFrames()]; stackArray = crashes.get(crashIndex).getFrames().toArray(stackArray); Throwable targetException = new Exception(); targetException.setStackTrace(stackArray); return targetException; } private  CrashProperties(); }
CrashProperties { public Throwable getTargetException(int crashIndex) { if (crashes.size() <= crashIndex) { throw new IndexOutOfBoundsException("The given index for crashes is out of bounds"); } StackTraceElement[] stackArray = new StackTraceElement[crashes.get(crashIndex).getNumberOfFrames()]; stackArray = crashes.get(crashIndex).getFrames().toArray(stackArray); Throwable targetException = new Exception(); targetException.setStackTrace(stackArray); return targetException; } private  CrashProperties(); static CrashProperties getInstance(); String getStringValue(String property); int getIntValue(String property); long getLongValue(String property); Boolean getBooleanValue(String property); void setupStackTrace(String stacktraceFile, int targetFrame); void setupStackTrace(StackTrace crash); void setClasspath(String projectClassPath); void setClasspath(String[] projectClassPath); String[] getProjectClassPaths(); StackTrace getStackTrace(int index); Properties.StoppingCondition getStoppingCondition(); Throwable getTargetException(int crashIndex); void resetStackTrace(int index); void clearStackTraceList(); List<String> getTargetClasses(int index); int getCrashesSize(); }
CrashProperties { public Throwable getTargetException(int crashIndex) { if (crashes.size() <= crashIndex) { throw new IndexOutOfBoundsException("The given index for crashes is out of bounds"); } StackTraceElement[] stackArray = new StackTraceElement[crashes.get(crashIndex).getNumberOfFrames()]; stackArray = crashes.get(crashIndex).getFrames().toArray(stackArray); Throwable targetException = new Exception(); targetException.setStackTrace(stackArray); return targetException; } private  CrashProperties(); static CrashProperties getInstance(); String getStringValue(String property); int getIntValue(String property); long getLongValue(String property); Boolean getBooleanValue(String property); void setupStackTrace(String stacktraceFile, int targetFrame); void setupStackTrace(StackTrace crash); void setClasspath(String projectClassPath); void setClasspath(String[] projectClassPath); String[] getProjectClassPaths(); StackTrace getStackTrace(int index); Properties.StoppingCondition getStoppingCondition(); Throwable getTargetException(int crashIndex); void resetStackTrace(int index); void clearStackTraceList(); List<String> getTargetClasses(int index); int getCrashesSize(); static final String CONFIG_PROPERTIES_FILE_NAME; @Properties.Parameter(key = "SearchAlgorithm", group = "Crash reproduction", description = "Which search algorithm to use for crash reproduction")
    static CrashProperties.SearchAlgorithm searchAlgorithm; @Properties.Parameter(key = "FitnessFunctions", group = "Crash reproduction", description = "Which fitness function should be used for the GGA")
    static CrashProperties.FitnessFunction[] fitnessFunctions; @Parameter(key = "max_target_injection_tries", group = "Runtime", description = "The maximum number of times the search tries to generate an individuals with the target method.")
    static int max_target_injection_tries; @Parameter(key = "integration_testing", group = "Crash reproduction", description = "Use integration testing for reproduce the crash.")
    static boolean integrationTesting; @Parameter(key = "line_estimation", group = "Crash reproduction", description = "Detect Missing lines in the stack trace")
    static boolean lineEstimation; @Parameter(key = "io_diversity", group = "Crash reproduction", description = "Enables I/O diversity as extra goals to MOSA")
    static boolean IODiversity; }