<commit_before>package net.orfjackal.specsy.core

import org.junit.Test
import org.junit.Assert._
import org.hamcrest.CoreMatchers._
import net.orfjackal.specsy.Spec
import net.orfjackal.specsy.runner.notification._
import java.lang.Throwable
import scala.collection.mutable.Buffer

class SpecClassRunnerTest {
  @Test
  def exceptions_thrown_by_the_root_spec_are_not_wrapped_in_InvocationTargetException() {
    val notifier = new FailureLoggingNotifier
    val runner = new SpecClassRunner(classOf[DummySpecWhoseRootThrowsAnException], notifier)

    runner.run()

    val exception = notifier.failures.head
    assertThat(exception, is(classOf[AssertionError]))
    assertThat(exception.getMessage, is("exception in root"))
  }

  private class FailureLoggingNotifier extends NullSuiteNotifier with TestNotifier {
    val failures = Buffer[Throwable]()

    override def fireTestStarted(path: Path) = this

    def fireFailure(cause: Throwable) {
      failures.append(cause)
    }

    def fireTestFinished() {}
  }
}

class DummySpecWhoseRootThrowsAnException extends Spec {
  throw new AssertionError("exception in root")
}
<commit_msg>Simplified SpecClassRunnerTest<commit_after>package net.orfjackal.specsy.core

import org.junit.Test
import org.junit.Assert._
import org.hamcrest.CoreMatchers._
import net.orfjackal.specsy.Spec
import net.orfjackal.specsy.runner.SuiteMonitor

class SpecClassRunnerTest {
  @Test
  def exceptions_thrown_by_the_root_spec_are_not_wrapped_in_InvocationTargetException() {
    val unusedCapturer = new OutputCapturer(null, null)
    val monitor = new SuiteMonitor(null, unusedCapturer)
    val runner = new SpecClassRunner(classOf[DummySpecWhoseRootThrowsAnException], monitor)

    runner.run()

    val exception = monitor.results(Path.Root).failures.head
    assertThat(exception, is(classOf[AssertionError]))
    assertThat(exception.getMessage, is("exception in root"))
  }
}

class DummySpecWhoseRootThrowsAnException extends Spec {
  throw new AssertionError("exception in root")
}

{'fraction_non_alphanumeric': 0.08086785009861933, 'fraction_numerical': 0.0, 'mean_word_length': 5.461783439490445, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3523013', 'n_tokens_mistral': 618, 'n_tokens_neox': 613, 'n_words': 122}