<commit_before>package nl.hsac.fitnesse.junit;

import fitnesse.components.PluginsClassLoader;
import fitnesse.junit.JUnitHelper;
import fitnesse.junit.JUnitXMLTestListener;
import fitnesse.junit.JavaFormatter;

import java.io.File;
import java.io.IOException;

/**
 * Helper to run Fitnesse tests from JUnit tests.
 */
public class FitnesseFromJUnitRunner {
    private boolean loadPlugins = true;
    private String fitnesseRoot = ".";
    private String xmlOutputPath = "../target/failsafe-reports";
    private String htmlOutputPath = "../target/fitnesse-results";

    /**
     * Runs a suite of Fitnesse tests. One JUnit test will be reported for each page executed.
     * @param suiteName name of suite to run (maybe overridden by a system property
     * @throws Exception
     */
    public void assertSuitePasses(String suiteName) throws Exception {
        if (loadPlugins) {
            loadPlugins();
        }
        JUnitXMLTestListener resultsListener = new JUnitXMLTestListener(xmlOutputPath);
        JUnitHelper jUnitHelper = new JUnitHelper(fitnesseRoot, htmlOutputPath, resultsListener);

        try {
            jUnitHelper.assertSuitePasses(suiteName);
        } finally {
            addFilesToHtmlOutput();
        }
    }

    protected void addFilesToHtmlOutput() throws IOException {
        copyResourceToHtmlOutput("css/fitnesse.css");
        copyResourceToHtmlOutput("css/fitnesse_pages.css");
        copyResourceToHtmlOutput("css/fitnesse_wiki.css");
        copyResourceToHtmlOutput("css/fitnesse_straight.css");

    }

    protected void copyResourceToHtmlOutput(String resource) throws IOException {
        String src = "/fitnesse/resources/" + resource;
        String dest = htmlOutputPath + "/" + resource;

        File target = new File(dest);<commit_msg>fix comment<commit_after>package nl.hsac.fitnesse.junit;

import fitnesse.components.PluginsClassLoader;
import fitnesse.junit.JUnitHelper;
import fitnesse.junit.JUnitXMLTestListener;
import fitnesse.junit.JavaFormatter;

import java.io.File;
import java.io.IOException;

/**
 * Helper to run Fitnesse tests from JUnit tests.
 */
public class FitnesseFromJUnitRunner {
    private boolean loadPlugins = true;
    private String fitnesseRoot = ".";
    private String xmlOutputPath = "../target/failsafe-reports";
    private String htmlOutputPath = "../target/fitnesse-results";

    /**
     * Runs a suite of Fitnesse tests. One JUnit test will be reported for each page executed.
     * @param suiteName name of suite to run
     * @throws Exception
     */
    public void assertSuitePasses(String suiteName) throws Exception {
        if (loadPlugins) {
            loadPlugins();
        }
        JUnitXMLTestListener resultsListener = new JUnitXMLTestListener(xmlOutputPath);
        JUnitHelper jUnitHelper = new JUnitHelper(fitnesseRoot, htmlOutputPath, resultsListener);

        try {
            jUnitHelper.assertSuitePasses(suiteName);
        } finally {
            addFilesToHtmlOutput();
        }
    }

    protected void addFilesToHtmlOutput() throws IOException {
        copyResourceToHtmlOutput("css/fitnesse.css");
        copyResourceToHtmlOutput("css/fitnesse_pages.css");
        copyResourceToHtmlOutput("css/fitnesse_wiki.css");
        copyResourceToHtmlOutput("css/fitnesse_straight.css");

    }

    protected void copyResourceToHtmlOutput(String resource) throws IOException {
        String src = "/fitnesse/resources/" + resource;
        String dest = htmlOutputPath + "/" + resource;

        File target = new File(dest);
{'fraction_non_alphanumeric': 0.08779803646563815, 'fraction_numerical': 0.0, 'mean_word_length': 3.275779376498801, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '678476', 'n_tokens_mistral': 999, 'n_tokens_neox': 977, 'n_words': 236}