All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.scalatest.SeveredStackTraces.scala Maven / Gradle / Ivy

Go to download

ScalaTest is a free, open-source testing toolkit for Scala and Java programmers.

The newest version!
package org.scalatest

/**
 * Trait that causes StackDepth exceptions thrown by a running test (such as TestFailedExceptions) to have
 * the exception's stack trace severed at the stack depth. Because the stack depth indicates the exact line of code that caused
 * the exception to be thrown, the severed stack trace will show that offending line of code on top. This can make the line
 * of test code that discovered a problem to be more easily found in IDEs and tools that don't make use of
 * ScalaTest's StackDepth exceptions directly.
 *
 * @author Bill Venners
 */
trait SeveredStackTraces extends AbstractSuite { this: Suite =>

  abstract override def withFixture(test: NoArgTest) {
    try {
      super.withFixture(test)
    }
    catch {
      case e: StackDepth =>
        throw e.severedAtStackDepth
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy