trait StackDepth extends AnyRef
Trait that encapsulates the information required of an exception thrown by ScalaTest's assertions and matchers, which includes a stack depth at which the failing line of test code resides.
This trait exists so that it can be mixed into two exception superclasses, StackDepthException
,
from which extend several exceptions that do not depend on JUnit, and JUnitTestFailedError
, which
does depend on JUnit. The latter, which requires JUnit be in the classpath, ensures failed ScalaTest assertions are
reported as "failures," not "errors," by JUnit.
- Self Type
- StackDepth with Throwable
- Source
- StackDepth.scala
- Alphabetic
- By Inheritance
- StackDepth
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
val
cause: Option[Throwable]
An optional cause, the
Throwable
that caused thisStackDepth
exception to be thrown. -
abstract
val
failedCodeFilePathname: Option[String]
A string that provides the full pathname of the source file containing the line of code that failed, suitable for presenting to a user.
A string that provides the full pathname of the source file containing the line of code that failed, suitable for presenting to a user.
- returns
a string containing the full pathname of the source file containing the line of code that caused this exception
-
abstract
val
failedCodeStackDepth: Int
The depth in the stack trace of this exception at which the line of test code that failed resides.
-
abstract
val
message: Option[String]
An optional detail message for this
StackDepth
exception. -
abstract
val
position: Option[Position]
An optional source position describing the line of test code that caused this exception.
-
abstract
def
severedAtStackDepth: Throwable with StackDepth
Returns an exception of the same class with
failedExceptionStackDepth
set to 0 and all frames above this stack depth severed off.Returns an exception of the same class with
failedExceptionStackDepth
set to 0 and all frames above this stack depth severed off. This can be useful when working with tools (such as IDEs) that do not directly support ScalaTest. (Tools that directly support ScalaTest can use the stack depth information delivered in the StackDepth exceptions.)
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
failedCodeFileName: Option[String]
A string that provides the filename of the line of code that failed, suitable for presenting to a user, which is taken from this exception's
StackTraceElement
at the depth specified byfailedCodeStackDepth
.A string that provides the filename of the line of code that failed, suitable for presenting to a user, which is taken from this exception's
StackTraceElement
at the depth specified byfailedCodeStackDepth
.This is a
def
instead of aval
because exceptions are mutable: their stack trace can be changed after the exception is created. This is done, for example, by theSeveredStackTraces
trait.- returns
a string containing the filename that caused the failed test
-
def
failedCodeFileNameAndLineNumberString: Option[String]
A string that provides the filename and line number of the line of code that failed, suitable for presenting to a user of the failing line.
A string that provides the filename and line number of the line of code that failed, suitable for presenting to a user of the failing line. It calls
failedCodeFileName
andfailedCodeLineNumber
to get the failing filename and line number.failedCodeFileName
andfailedCodeLineNumber
will fall back to exception stack trace whenPosition
is not avaiable, this is the reason it is adef
instead of aval
, because exceptions are mutable: their stack trace can be changed after the exception is created. This is done, for example, by theSeveredStackTraces
trait.- returns
a user-presentable string containing the filename and line number that caused the failed test
-
lazy val
failedCodeFilePathnameAndLineNumberString: Option[String]
A string that provides the absolute filename and line number of the line of code that failed, suitable for presenting to a user of the failing line.
A string that provides the absolute filename and line number of the line of code that failed, suitable for presenting to a user of the failing line. It calls
failedCodeFilePathname
andfailedCodeLineNumber
to get the failing absolute filename and line number.- returns
a user-presentable string containing the absolute filename and line number that caused the failed test
-
def
failedCodeLineNumber: Option[Int]
A string that provides the line number of the line of code that failed, suitable for presenting to a user, which is taken from this exception's
StackTraceElement
at the depth specified byfailedCodeStackDepth
.A string that provides the line number of the line of code that failed, suitable for presenting to a user, which is taken from this exception's
StackTraceElement
at the depth specified byfailedCodeStackDepth
.This is a
def
instead of aval
because exceptions are mutable: their stack trace can be changed after the exception is created. This is done, for example, by theSeveredStackTraces
trait.- returns
a string containing the line number that caused the failed test
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )