<commit_before>package org.apache.datacommons.prepbuddy.functional.tests.framework

import org.apache.spark.{SparkConf, SparkContext}

import scala.collection.mutable.ListBuffer

class FunctionalTest extends App {
    protected val sc: SparkContext = new SparkContext(sparkConf)
    private val sparkConf: SparkConf = new SparkConf().setAppName(getClass.getName)
    private val testReport = new TestReport
    private var testNames: ListBuffer[String] = ListBuffer.empty

    def test(testName: String)(testFunction: => Unit) {
        validateTestEnvironment(testName)
        testNames += testName
        val testResult: TestResult = runTest(testName, testFunction)
        testReport.add(testResult)
    }

    def runTest(testName: String, testFunction: => Unit): TestResult = {
        val exceptionalTestFun: () => Any = testFunction _
        val testResult: TestResult = new TestResult(testName)
        try {
            exceptionalTestFun()
            testResult.markAsSuccess()
        } catch {
            case err: AssertionError => testResult.markAsFailure(err)
        }
        testResult
    }

    def validateTestEnvironment(testName: String) {
        if (testNames.contains(testName)) {
            throw new DuplicateTestNameException("Duplicate test name: " + testName)
        }
    }

    def printReport() {
        testReport.show()
        shutDown()
        if (testReport.hasFailingTest) {
            throw new AssertionFailedException("Test is failing because of assertion failure")
        }
    }

    def shutDown(): Unit = sc.stop()
}<commit_msg>Fixing the bug in the Test Runner.<commit_after>package org.apache.datacommons.prepbuddy.functional.tests.framework

import org.apache.spark.{SparkConf, SparkContext}

import scala.collection.mutable.ListBuffer

class FunctionalTest extends App {
    private val sparkConf: SparkConf = new SparkConf().setAppName(getClass.getName)
    private val testReport = new TestReport
    private var testNames: ListBuffer[String] = ListBuffer.empty

    def test(testName: String)(testFunction: => Unit) {
        validateTestEnvironment(testName)
        testNames += testName
        val testResult: TestResult = runTest(testName, testFunction)
        testReport.add(testResult)
    }

    def runTest(testName: String, testFunction: => Unit): TestResult = {
        val exceptionalTestFun: () => Any = testFunction _
        val testResult: TestResult = new TestResult(testName)
        try {
            exceptionalTestFun()
            testResult.markAsSuccess()
        } catch {
            case err: AssertionError => testResult.markAsFailure(err)
        }
        testResult
    }

    def validateTestEnvironment(testName: String) {
        if (testNames.contains(testName)) {
            throw new DuplicateTestNameException("Duplicate test name: " + testName)
        }
    }

    def printReport() {
        testReport.show()
        shutDown()
        if (testReport.hasFailingTest) {
            throw new AssertionFailedException("Test is failing because of assertion failure")
        }
    }

    def shutDown(): Unit = sc.stop()

    protected def sc: SparkContext = new SparkContext(sparkConf)
}
{'fraction_non_alphanumeric': 0.08735128365685661, 'fraction_numerical': 0.0, 'mean_word_length': 2.901098901098901, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '1571704', 'n_tokens_mistral': 874, 'n_tokens_neox': 849, 'n_words': 206}