Exemple #1
0
  public List<Patch> build(String[] testClasses) {
    gZoltar = GZoltarSuspiciousProgramStatements.create(this.classpath, testClasses);
    Collection<Statement> statements = gZoltar.sortBySuspiciousness(testClasses);
    if (statements.isEmpty()) {
      throw new RuntimeException("No suspicious statements found.");
    }

    Map<SourceLocation, List<TestResult>> testListPerStatement = getTestListPerStatement();

    if (Config.INSTANCE.getOracle() == Config.NopolOracle.SYMBOLIC) {
      try {
        this.classpath = addJPFLibraryToCassPath(classpath);
        SpoonedProject jpfSpoon = new SpoonedProject(this.sourceFiles, classpath);
        String mainClass = "nopol.repair.NopolTestRunner";
        TestExecutorProcessor.createMainTestClass(jpfSpoon, mainClass);
        jpfSpoon.process(new AssertReplacer());

        final File outputSourceFile = new File("src-gen");
        final File outputCompiledFile = new File("target-gen");
        // generate the output file
        jpfSpoon.generateOutputFile(outputSourceFile);
        jpfSpoon.generateOutputCompiledFile(outputCompiledFile);
      } catch (IOException e) {
        throw new RuntimeException("Unable to write transformed test", e);
      }
    }

    return solveWithMultipleBuild(statements, testListPerStatement);
  }