org.scalatest.events.Event.scala Maven / Gradle / Ivy
Show all versions of scalatest_2.8.1 Show documentation
/*
* Copyright 2001-2008 Artima, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.scalatest.events
import org.scalatest._
import java.util.Date
/**
* A base class for the events that can be passed to the report function passed
* to the execute method of a Suite.
*
* Will have a sealed abstract InfoProvided message with three final concrete subclasses,
* RunInfoProvided, SuiteInfoProvided, TestInfoProvided. Anything that starts with Run just
* has runStamp and ordinal; Suite has those plus suiteStamp; Test has those plus testStamp.
*
* @author Bill Venners
*/
sealed abstract class Event extends Ordered[Event] with java.io.Serializable {
/**
* An Ordinal that can be used to place this event in order in the context of
* other events reported during the same run.
*/
val ordinal: Ordinal
/**
* An optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user.
*/
val formatter: Option[Formatter]
/**
* An optional object that can be used to pass custom information to the reporter about this event.
*/
val payload: Option[Any]
/**
* A name for the Thread about whose activity this event was reported.
*/
val threadName: String
/**
* A Long indicating the time this event was reported, expressed in terms of the
* number of milliseconds since the standard base time known as "the epoch":
* January 1, 1970, 00:00:00 GMT.
*/
val timeStamp: Long
/**
* Comparing this event with the event passed as that. Returns
* x, where x < 0 iff this < that, x == 0 iff this == that, x > 0 iff this > that.
*
* @param that the event to compare to this event
* @param return an integer indicating whether this event is less than, equal to, or greater than
* the passed event
*/
def compare(that: Event): Int = ordinal.compare(that.ordinal)
}
/**
* Event that indicates a suite (or other entity) is about to start running a test.
*
*
* For example, trait Suite uses TestStarting to report
* that a test method of a Suite is about to be invoked.
*
*
*
* To create instances of this class you may
* use one of the factory methods provided in its companion object. For example, given a
* report function named report, you could fire a TestStarting event like this:
*
*
*
* report(TestStarting(ordinal, userFriendlyName, suiteName, Some(thisSuite.getClass.getName), testName))
*
*
*
* The suite class name parameter is optional, because suites in ScalaTest are an abstraction that
* need not necessarily correspond to one class. Nevertheless, it most cases each suite will correspond
* to a class, and when it does, the fully qualified name of that class should be reported by passing a
* Some for suiteClassName. One use for this bit of information is JUnit integration,
* because the "name" provided to a JUnit org.junit.runner.Description appears to usually include
* a fully qualified class name by convention.
*
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the test that is starting
* @param suiteClassName an optional fully qualifed Suite class name containing the test that is starting
* @param testName the name of the test that is starting
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param rerunner an optional Rerunner that can be used to rerun the test that is starting (if None
* is passed, the test cannot be rerun)
* @param payload an optional object that can be used to pass custom information to the reporter about the TestStarting event
* @param threadName a name for the Thread about whose activity this event was reported
* @param timeStamp a Long indicating the time this event was reported, expressed in terms of the
* number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
*
* @author Bill Venners
*/
final case class TestStarting (
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
testName: String,
formatter: Option[Formatter],
rerunner: Option[Rerunner],
payload: Option[Any],
threadName: String,
timeStamp: Long
) extends Event {
if (ordinal == null)
throw new NullPointerException("ordinal was null")
if (suiteName == null)
throw new NullPointerException("suiteName was null")
if (suiteClassName == null)
throw new NullPointerException("suiteClassName was null")
if (testName == null)
throw new NullPointerException("testName was null")
if (formatter == null)
throw new NullPointerException("formatter was null")
if (rerunner == null)
throw new NullPointerException("rerunner was null")
if (payload == null)
throw new NullPointerException("payload was null")
if (threadName == null)
throw new NullPointerException("threadName was null")
}
/**
* Companion object for the TestStarting event, which contains overloaded factory methods
* and an extractor method to facilitate pattern matching on TestStarting objects.
*
*
* All factory methods throw NullPointerException if any of the passed values are null.
*
*
* @author Bill Venners
*/
object TestStarting {
/**
* Constructs a new TestStarting event with the passed parameters, passing the current thread's
* name as threadname and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the test that is starting
* @param suiteClassName an optional fully qualifed Suite class name containing the test that is starting
* @param testName the name of the test that is starting
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param rerunner an optional Rerunner that can be used to rerun the test that is starting (if None
* is passed, the test cannot be rerun)
* @param payload an optional object that can be used to pass custom information to the reporter about the TestStarting event
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new TestStarting instance initialized with the passed and default values
*
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
testName: String,
formatter: Option[Formatter],
rerunner: Option[Rerunner],
payload: Option[Any]
): TestStarting = {
apply(ordinal, suiteName, suiteClassName, testName, formatter, rerunner, payload, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new TestStarting event with the passed parameters, passing None as the
* payload, the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the test that is starting
* @param suiteClassName an optional fully qualifed Suite class name containing the test that is starting
* @param testName the name of the test that is starting
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param rerunner an optional Rerunner that can be used to rerun the test that is starting (if None
* is passed, the test cannot be rerun)
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new TestStarting instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
testName: String,
formatter: Option[Formatter],
rerunner: Option[Rerunner]
): TestStarting = {
apply(ordinal, suiteName, suiteClassName, testName, formatter, rerunner, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new TestStarting event with the passed parameters, passing None as the
* rerunner, None as the payload, the current threads name as threadname,
* and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the test that is starting
* @param suiteClassName an optional fully qualifed Suite class name containing the test that is starting
* @param testName the name of the test that is starting
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new TestStarting instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
testName: String,
formatter: Option[Formatter]
): TestStarting = {
apply(ordinal, suiteName, suiteClassName, testName, formatter, None, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new TestStarting event with the passed parameters, passing None for
* formatter, None as the rerunner, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the test that is starting
* @param suiteClassName an optional fully qualifed Suite class name containing the test that is starting
* @param testName the name of the test that is starting
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new TestStarting instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
testName: String
): TestStarting = {
apply(ordinal, suiteName, suiteClassName, testName, None, None, None, Thread.currentThread.getName, (new Date).getTime)
}
}
/**
* Event that indicates a suite (or other entity) has completed running a test that succeeded.
*
*
* For example, trait Suite uses TestSucceeded to report
* that a test method of a Suite returned normally
* (without throwing an Exception).
*
*
*
* To create instances of this class you may
* use one of the factory methods provided in its companion object. For example, given a
* report function named report, you could fire a TestSucceeded event like this:
*
*
*
* report(TestSucceeded(ordinal, userFriendlyName, suiteName, Some(thisSuite.getClass.getName), testName))
*
*
*
* The suite class name parameter is optional, because suites in ScalaTest are an abstraction that
* need not necessarily correspond to one class. Nevertheless, it most cases each suite will correspond
* to a class, and when it does, the fully qualified name of that class should be reported by passing a
* Some for suiteClassName. One use for this bit of information is JUnit integration,
* because the "name" provided to a JUnit org.junit.runner.Description appears to usually include
* a fully qualified class name by convention.
*
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the test that has succeeded
* @param suiteClassName an optional fully qualifed Suite class name containing the test that has succeeded
* @param testName the name of the test that has succeeded
* @param duration an optional amount of time, in milliseconds, that was required to run the test that has succeeded
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param rerunner an optional Rerunner that can be used to rerun the test that has succeeded (if None
* is passed, the test cannot be rerun)
* @param payload an optional object that can be used to pass custom information to the reporter about the TestSucceeded event
* @param threadName a name for the Thread about whose activity this event was reported
* @param timeStamp a Long indicating the time this event was reported, expressed in terms of the
* number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
*
* @author Bill Venners
*/
final case class TestSucceeded (
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
testName: String,
duration: Option[Long],
formatter: Option[Formatter],
rerunner: Option[Rerunner],
payload: Option[Any],
threadName: String,
timeStamp: Long
) extends Event {
if (ordinal == null)
throw new NullPointerException("ordinal was null")
if (suiteName == null)
throw new NullPointerException("suiteName was null")
if (suiteClassName == null)
throw new NullPointerException("suiteClassName was null")
if (testName == null)
throw new NullPointerException("testName was null")
if (duration == null)
throw new NullPointerException("duration was null")
if (formatter == null)
throw new NullPointerException("formatter was null")
if (rerunner == null)
throw new NullPointerException("rerunner was null")
if (payload == null)
throw new NullPointerException("payload was null")
if (threadName == null)
throw new NullPointerException("threadName was null")
}
/**
* Companion object for the TestSucceeded event, which contains overloaded factory methods
* and an extractor method to facilitate pattern matching on TestSucceeded objects.
*
*
* All factory methods throw NullPointerException if any of the passed values are null.
*
*
* @author Bill Venners
*/
object TestSucceeded {
/**
* Constructs a new TestSucceeded event with the passed parameters, passing the current thread's
* name as threadname and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the test that has succeeded
* @param suiteClassName an optional fully qualifed Suite class name containing the test that has succeeded
* @param testName the name of the test that has succeeded
* @param duration an optional amount of time, in milliseconds, that was required to run the test that has succeeded
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param rerunner an optional Rerunner that can be used to rerun the test that has succeeded (if None
* is passed, the test cannot be rerun)
* @param payload an optional object that can be used to pass custom information to the reporter about the TestSucceeded event
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new TestSucceeded instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
testName: String,
duration: Option[Long],
formatter: Option[Formatter],
rerunner: Option[Rerunner],
payload: Option[Any]
): TestSucceeded = {
apply(ordinal, suiteName, suiteClassName, testName, duration, formatter, rerunner, payload, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new TestSucceeded event with the passed parameters, passing None as the
* payload, the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the test that has succeeded
* @param suiteClassName an optional fully qualifed Suite class name containing the test that has succeeded
* @param testName the name of the test that has succeeded
* @param duration an optional amount of time, in milliseconds, that was required to run the test that has succeeded
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param rerunner an optional Rerunner that can be used to rerun the test that has succeeded (if None
* is passed, the test cannot be rerun)
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new TestSucceeded instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
testName: String,
duration: Option[Long],
formatter: Option[Formatter],
rerunner: Option[Rerunner]
): TestSucceeded = {
apply(ordinal, suiteName, suiteClassName, testName, duration, formatter, rerunner, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new TestSucceeded event with the passed parameters, passing None as the
* rerunner, None as the payload, the current threads name as threadname,
* and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the test that has succeeded
* @param suiteClassName an optional fully qualifed Suite class name containing the test that has succeeded
* @param testName the name of the test that has succeeded
* @param duration an optional amount of time, in milliseconds, that was required to run the test that has succeeded
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new TestSucceeded instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
testName: String,
duration: Option[Long],
formatter: Option[Formatter]
): TestSucceeded = {
apply(ordinal, suiteName, suiteClassName, testName, duration, formatter, None, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new TestSucceeded event with the passed parameters, passing None for
* formatter, None as the rerunner, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the test that has succeeded
* @param suiteClassName an optional fully qualifed Suite class name containing the test that has succeeded
* @param testName the name of the test that has succeeded
* @param duration an optional amount of time, in milliseconds, that was required to run the test that has succeeded
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new TestSucceeded instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
testName: String,
duration: Option[Long]
): TestSucceeded = {
apply(ordinal, suiteName, suiteClassName, testName, duration, None, None, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new TestSucceeded event with the passed parameters, passing None for duration,
* None for formatter, None as the rerunner, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the test that has succeeded
* @param suiteClassName an optional fully qualifed Suite class name containing the test that has succeeded
* @param testName the name of the test that has succeeded
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new TestSucceeded instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
testName: String
): TestSucceeded = {
apply(ordinal, suiteName, suiteClassName, testName, None, None, None, None, Thread.currentThread.getName, (new Date).getTime)
}
}
/**
* Event that indicates a suite (or other entity) has completed running a test that failed.
*
*
* For example, trait Suite uses TestFailed to report
* that a test method of a Suite completed abruptly with an Exception.
*
*
*
* To create instances of this class you may
* use one of the factory methods provided in its companion object. For example, given a
* report function named report, you could fire a TestFailed event like this:
*
*
*
* report(TestFailed(ordinal, userFriendlyName, message, suiteName, Some(thisSuite.getClass.getName), testName))
*
*
*
* The suite class name parameter is optional, because suites in ScalaTest are an abstraction that
* need not necessarily correspond to one class. Nevertheless, it most cases each suite will correspond
* to a class, and when it does, the fully qualified name of that class should be reported by passing a
* Some for suiteClassName. One use for this bit of information is JUnit integration,
* because the "name" provided to a JUnit org.junit.runner.Description appears to usually include
* a fully qualified class name by convention.
*
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param suiteName the name of the suite containing the test that has failed
* @param suiteClassName an optional fully qualifed Suite class name containing the test that has failed
* @param testName the name of the test that has failed
* @param throwable an optional Throwable that, if a Some, indicates why the test has failed,
* or a Throwable created to capture stack trace information about the problem.
* @param duration an optional amount of time, in milliseconds, that was required to run the test that has failed
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param rerunner an optional Rerunner that can be used to rerun the test that has failed (if None
* is passed, the test cannot be rerun)
* @param payload an optional object that can be used to pass custom information to the reporter about the TestFailed event
* @param threadName a name for the Thread about whose activity this event was reported
* @param timeStamp a Long indicating the time this event was reported, expressed in terms of the
* number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
*
* @author Bill Venners
*/
final case class TestFailed (
ordinal: Ordinal,
message: String,
suiteName: String,
suiteClassName: Option[String],
testName: String,
throwable: Option[Throwable],
duration: Option[Long],
formatter: Option[Formatter],
rerunner: Option[Rerunner],
payload: Option[Any],
threadName: String,
timeStamp: Long
) extends Event {
if (ordinal == null)
throw new NullPointerException("ordinal was null")
if (message == null)
throw new NullPointerException("message was null")
if (suiteName == null)
throw new NullPointerException("suiteName was null")
if (suiteClassName == null)
throw new NullPointerException("suiteClassName was null")
if (testName == null)
throw new NullPointerException("testName was null")
if (throwable == null)
throw new NullPointerException("throwable was null")
if (duration == null)
throw new NullPointerException("duration was null")
if (formatter == null)
throw new NullPointerException("formatter was null")
if (rerunner == null)
throw new NullPointerException("rerunner was null")
if (payload == null)
throw new NullPointerException("payload was null")
if (threadName == null)
throw new NullPointerException("threadName was null")
}
/**
* Companion object for the TestFailed event, which contains overloaded factory methods
* and an extractor method to facilitate pattern matching on TestFailed objects.
*
*
* All factory methods throw NullPointerException if any of the passed values are null.
*
*
* @author Bill Venners
*/
object TestFailed {
/**
* Constructs a new TestFailed event with the passed parameters, passing the current thread's
* name as threadname and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param suiteName the name of the suite containing the test that has failed
* @param suiteClassName an optional fully qualifed Suite class name containing the test that has failed
* @param testName the name of the test that has failed
* @param throwable an optional Throwable that, if a Some, indicates why the test has failed,
* or a Throwable created to capture stack trace information about the problem.
* @param duration an optional amount of time, in milliseconds, that was required to run the test that has failed
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param rerunner an optional Rerunner that can be used to rerun the test that has failed (if None
* is passed, the test cannot be rerun)
* @param payload an optional object that can be used to pass custom information to the reporter about the TestFailed event
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new TestFailed instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
message: String,
suiteName: String,
suiteClassName: Option[String],
testName: String,
throwable: Option[Throwable],
duration: Option[Long],
formatter: Option[Formatter],
rerunner: Option[Rerunner],
payload: Option[Any]
): TestFailed = {
apply(ordinal, message, suiteName, suiteClassName, testName, throwable, duration, formatter, rerunner, payload, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new TestFailed event with the passed parameters, passing None as the
* payload, the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param suiteName the name of the suite containing the test that has failed
* @param suiteClassName an optional fully qualifed Suite class name containing the test that has failed
* @param testName the name of the test that has failed
* @param throwable an optional Throwable that, if a Some, indicates why the test has failed,
* or a Throwable created to capture stack trace information about the problem.
* @param duration an optional amount of time, in milliseconds, that was required to run the test that has failed
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param rerunner an optional Rerunner that can be used to rerun the test that has failed (if None
* is passed, the test cannot be rerun)
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new TestFailed instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
message: String,
suiteName: String,
suiteClassName: Option[String],
testName: String,
throwable: Option[Throwable],
duration: Option[Long],
formatter: Option[Formatter],
rerunner: Option[Rerunner]
): TestFailed = {
apply(ordinal, message, suiteName, suiteClassName, testName, throwable, duration, formatter, rerunner, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new TestFailed event with the passed parameters, passing None as the
* rerunner, None as the payload, the current threads name as threadname,
* and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param suiteName the name of the suite containing the test that has failed
* @param suiteClassName an optional fully qualifed Suite class name containing the test that has failed
* @param testName the name of the test that has failed
* @param throwable an optional Throwable that, if a Some, indicates why the test has failed,
* or a Throwable created to capture stack trace information about the problem.
* @param duration an optional amount of time, in milliseconds, that was required to run the test that has failed
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new TestFailed instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
message: String,
suiteName: String,
suiteClassName: Option[String],
testName: String,
throwable: Option[Throwable],
duration: Option[Long],
formatter: Option[Formatter]
): TestFailed = {
apply(ordinal, message, suiteName, suiteClassName, testName, throwable, duration, formatter, None, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new TestFailed event with the passed parameters, passing None for
* formatter, None as the rerunner, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param suiteName the name of the suite containing the test that has failed
* @param suiteClassName an optional fully qualifed Suite class name containing the test that has failed
* @param testName the name of the test that has failed
* @param throwable an optional Throwable that, if a Some, indicates why the test has failed,
* or a Throwable created to capture stack trace information about the problem.
* @param duration an optional amount of time, in milliseconds, that was required to run the test that has failed
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new TestFailed instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
message: String,
suiteName: String,
suiteClassName: Option[String],
testName: String,
throwable: Option[Throwable],
duration: Option[Long]
): TestFailed = {
apply(ordinal, message, suiteName, suiteClassName, testName, throwable, duration, None, None, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new TestFailed event with the passed parameters, passing None for duration,
* None for formatter, None as the rerunner, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param suiteName the name of the suite containing the test that has failed
* @param suiteClassName an optional fully qualifed Suite class name containing the test that has failed
* @param testName the name of the test that has failed
* @param throwable an optional Throwable that, if a Some, indicates why the test has failed,
* or a Throwable created to capture stack trace information about the problem.
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new TestFailed instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
message: String,
suiteName: String,
suiteClassName: Option[String],
testName: String,
throwable: Option[Throwable]
): TestFailed = {
apply(ordinal, message, suiteName, suiteClassName, testName, throwable, None, None, None, None, Thread.currentThread.getName, (new Date).getTime)
}
}
/**
* Event that indicates a suite (or other entity) has ignored a test.
*
*
* For example, trait Suite uses TestIgnored to report
* that a test method of a Suite was ignored because it was annotated with @Ignore.
* Ignored tests will not be run, but will usually be reported as reminder to fix the broken test.
*
*
*
* To create instances of this class you may
* use one of the factory methods provided in its companion object. For example, given a
* report function named report, you could fire a TestIgnored event like this:
*
*
*
* report(TestIgnored(ordinal, userFriendlyName, suiteName, Some(thisSuite.getClass.getName), testName))
*
*
*
* The suite class name parameter is optional, because suites in ScalaTest are an abstraction that
* need not necessarily correspond to one class. Nevertheless, it most cases each suite will correspond
* to a class, and when it does, the fully qualified name of that class should be reported by passing a
* Some for suiteClassName. One use for this bit of information is JUnit integration,
* because the "name" provided to a JUnit org.junit.runner.Description appears to usually include
* a fully qualified class name by convention.
*
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the test that was ignored
* @param suiteClassName an optional fully qualifed Suite class name containing the test that was ignored
* @param testName the name of the test that was ignored
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param payload an optional object that can be used to pass custom information to the reporter about the TestIgnored event
* @param threadName a name for the Thread about whose activity this event was reported
* @param timeStamp a Long indicating the time this event was reported, expressed in terms of the
* number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
*
* @author Bill Venners
*/
final case class TestIgnored (
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
testName: String,
formatter: Option[Formatter],
payload: Option[Any],
threadName: String,
timeStamp: Long
) extends Event {
if (ordinal == null)
throw new NullPointerException("ordinal was null")
if (suiteName == null)
throw new NullPointerException("suiteName was null")
if (suiteClassName == null)
throw new NullPointerException("suiteClassName was null")
if (testName == null)
throw new NullPointerException("testName was null")
if (formatter == null)
throw new NullPointerException("formatter was null")
if (payload == null)
throw new NullPointerException("payload was null")
if (threadName == null)
throw new NullPointerException("threadName was null")
}
/**
* Companion object for the TestIgnored event, which contains overloaded factory methods
* and an extractor method to facilitate pattern matching on TestIgnored objects.
*
*
* All factory methods throw NullPointerException if any of the passed values are null.
*
*
* @author Bill Venners
*/
object TestIgnored {
/**
* Constructs a new TestIgnored event with the passed parameters, passing the current thread's
* name as threadname and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the test that was ignored
* @param suiteClassName an optional fully qualifed Suite class name containing the test that was ignored
* @param testName the name of the test that was ignored
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param payload an optional object that can be used to pass custom information to the reporter about the TestIgnored event
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new TestIgnored instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
testName: String,
formatter: Option[Formatter],
payload: Option[Any]
): TestIgnored = {
apply(ordinal, suiteName, suiteClassName, testName, formatter, payload, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new TestIgnored event with the passed parameters, passing None as the
* payload, the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the test that was ignored
* @param suiteClassName an optional fully qualifed Suite class name containing the test that was ignored
* @param testName the name of the test that was ignored
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new TestIgnored instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
testName: String,
formatter: Option[Formatter]
): TestIgnored = {
apply(ordinal, suiteName, suiteClassName, testName, formatter, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new TestIgnored event with the passed parameters, passing None for
* formatter, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the test that was ignored
* @param suiteClassName an optional fully qualifed Suite class name containing the test that was ignored
* @param testName the name of the test that was ignored
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new TestIgnored instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
testName: String
): TestIgnored = {
apply(ordinal, suiteName, suiteClassName, testName, None, None, Thread.currentThread.getName, (new Date).getTime)
}
}
/**
* Event that indicates a test is pending, i.e., it hasn't yet been implemented.
*
*
* To create instances of this class you may
* use one of the factory methods provided in its companion object. For example, given a
* report function named report, you could fire a TestPending event like this:
*
*
*
* report(TestPending(ordinal, userFriendlyName, suiteName, Some(thisSuite.getClass.getName), testName))
*
*
*
* The suite class name parameter is optional, because suites in ScalaTest are an abstraction that
* need not necessarily correspond to one class. Nevertheless, it most cases each suite will correspond
* to a class, and when it does, the fully qualified name of that class should be reported by passing a
* Some for suiteClassName. One use for this bit of information is JUnit integration,
* because the "name" provided to a JUnit org.junit.runner.Description appears to usually include
* a fully qualified class name by convention.
*
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the test that is pending
* @param suiteClassName an optional fully qualifed Suite class name containing the test that is pending
* @param testName the name of the test that is pending
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param payload an optional object that can be used to pass custom information to the reporter about the TestPending event
* @param threadName a name for the Thread about whose activity this event was reported
* @param timeStamp a Long indicating the time this event was reported, expressed in terms of the
* number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
*
* @author Bill Venners
*/
final case class TestPending (
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
testName: String,
formatter: Option[Formatter],
payload: Option[Any],
threadName: String,
timeStamp: Long
) extends Event {
if (ordinal == null)
throw new NullPointerException("ordinal was null")
if (suiteName == null)
throw new NullPointerException("suiteName was null")
if (suiteClassName == null)
throw new NullPointerException("suiteClassName was null")
if (testName == null)
throw new NullPointerException("testName was null")
if (formatter == null)
throw new NullPointerException("formatter was null")
if (payload == null)
throw new NullPointerException("payload was null")
if (threadName == null)
throw new NullPointerException("threadName was null")
}
/**
* Companion object for the TestPending event, which contains overloaded factory methods
* and an extractor method to facilitate pattern matching on TestPending objects.
*
*
* All factory methods throw NullPointerException if any of the passed values are null.
*
*
* @author Bill Venners
*/
object TestPending {
/**
* Constructs a new TestPending event with the passed parameters, passing the current thread's
* name as threadname and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the test that is pending
* @param suiteClassName an optional fully qualifed Suite class name containing the test that is pending
* @param testName the name of the test that is pending
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param payload an optional object that can be used to pass custom information to the reporter about the TestPending event
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new TestPending instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
testName: String,
formatter: Option[Formatter],
payload: Option[Any]
): TestPending = {
apply(ordinal, suiteName, suiteClassName, testName, formatter, payload, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new TestPending event with the passed parameters, passing None as the
* payload, the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the test that is pending
* @param suiteClassName an optional fully qualifed Suite class name containing the test that is pending
* @param testName the name of the test that is pending
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new TestPending instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
testName: String,
formatter: Option[Formatter]
): TestPending = {
apply(ordinal, suiteName, suiteClassName, testName, formatter, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new TestPending event with the passed parameters, passing None for
* formatter, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the test that is pending
* @param suiteClassName an optional fully qualifed Suite class name containing the test that is pending
* @param testName the name of the test that is pending
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new TestPending instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
testName: String
): TestPending = {
apply(ordinal, suiteName, suiteClassName, testName, None, None, Thread.currentThread.getName, (new Date).getTime)
}
}
/**
* Event that indicates a suite of tests is about to start executing.
*
*
* For example, trait Suite and object Runner use SuiteStarting to report
* that the execute method of a Suite is about to be invoked.
*
*
*
* To create instances of this class you may
* use one of the factory methods provided in its companion object. For example, given a
* report function named report, you could fire a SuiteStarting event like this:
*
*
*
* report(SuiteStarting(ordinal, userFriendlyName, suiteName, Some(thisSuite.getClass.getName)))
*
*
*
* The suite class name parameter is optional, because suites in ScalaTest are an abstraction that
* need not necessarily correspond to one class. Nevertheless, it most cases each suite will correspond
* to a class, and when it does, the fully qualified name of that class should be reported by passing a
* Some for suiteClassName. One use for this bit of information is JUnit integration,
* because the "name" provided to a JUnit org.junit.runner.Description appears to usually include
* a fully qualified class name by convention.
*
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName a localized name identifying the suite that is starting, which should include the
* suite name, suitable for presenting to the user
* @param suiteClassName an optional fully qualifed Suite class name of the suite that is starting
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param rerunner an optional Rerunner that can be used to rerun the suite that is starting (if None
* is passed, the suite cannot be rerun)
* @param payload an optional object that can be used to pass custom information to the reporter about the SuiteStarting event
* @param threadName a name for the Thread about whose activity this event was reported
* @param timeStamp a Long indicating the time this event was reported, expressed in terms of the
* number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
*
* @author Bill Venners
*/
final case class SuiteStarting (
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
formatter: Option[Formatter],
rerunner: Option[Rerunner],
payload: Option[Any],
threadName: String,
timeStamp: Long
) extends Event {
if (ordinal == null)
throw new NullPointerException("ordinal was null")
if (suiteName == null)
throw new NullPointerException("suiteName was null")
if (suiteClassName == null)
throw new NullPointerException("suiteClassName was null")
if (formatter == null)
throw new NullPointerException("formatter was null")
if (rerunner == null)
throw new NullPointerException("rerunner was null")
if (payload == null)
throw new NullPointerException("payload was null")
if (threadName == null)
throw new NullPointerException("threadName was null")
}
/**
* Companion object for the SuiteStarting event, which contains overloaded factory methods
* and an extractor method to facilitate pattern matching on SuiteStarting objects.
*
*
* All factory methods throw NullPointerException if any of the passed values are null.
*
*
* @author Bill Venners
*/
object SuiteStarting {
/**
* Constructs a new SuiteStarting event with the passed parameters, passing the current thread's
* name as threadname and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName a localized name identifying the suite that is starting, which should include the
* suite name, suitable for presenting to the user
* @param suiteClassName an optional fully qualifed Suite class name of the suite that is starting
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param rerunner an optional Rerunner that can be used to rerun the suite that is starting (if None
* is passed, the suite cannot be rerun)
* @param payload an optional object that can be used to pass custom information to the reporter about the SuiteStarting event
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new SuiteStarting instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
formatter: Option[Formatter],
rerunner: Option[Rerunner],
payload: Option[Any]
): SuiteStarting = {
apply(ordinal, suiteName, suiteClassName, formatter, rerunner, payload, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new SuiteStarting event with the passed parameters, passing None as the
* payload, the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName a localized name identifying the suite that is starting, which should include the
* suite name, suitable for presenting to the user
* @param suiteClassName an optional fully qualifed Suite class name of the suite that is starting
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param rerunner an optional Rerunner that can be used to rerun the suite that is starting (if None
* is passed, the suite cannot be rerun)
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new SuiteStarting instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
formatter: Option[Formatter],
rerunner: Option[Rerunner]
): SuiteStarting = {
apply(ordinal, suiteName, suiteClassName, formatter, rerunner, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new SuiteStarting event with the passed parameters, passing None as the
* rerunner, None as the payload, the current threads name as threadname,
* and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName a localized name identifying the suite that is starting, which should include the
* suite name, suitable for presenting to the user
* @param suiteClassName an optional fully qualifed Suite class name of the suite that is starting
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new SuiteStarting instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
formatter: Option[Formatter]
): SuiteStarting = {
apply(ordinal, suiteName, suiteClassName, formatter, None, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new SuiteStarting event with the passed parameters, passing None for
* formatter, None as the rerunner, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName a localized name identifying the suite that is starting, which should include the
* suite name, suitable for presenting to the user
* @param suiteClassName an optional fully qualifed Suite class name of the suite that is starting
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new SuiteStarting instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String]
): SuiteStarting = {
apply(ordinal, suiteName, suiteClassName, None, None, None, Thread.currentThread.getName, (new Date).getTime)
}
}
/**
* Event that indicates a suite of tests has completed executing.
*
*
* For example, trait Suite and object Runner use SuiteCompleted to report
* that the execute method of a Suite
* has returned normally (without throwing a RuntimeException).
*
*
*
* To create instances of this class you may
* use one of the factory methods provided in its companion object. For example, given a
* report function named report, you could fire a SuiteCompleted event like this:
*
*
*
* report(SuiteCompleted(ordinal, userFriendlyName, suiteName, Some(thisSuite.getClass.getName)))
*
*
*
* The suite class name parameter is optional, because suites in ScalaTest are an abstraction that
* need not necessarily correspond to one class. Nevertheless, it most cases each suite will correspond
* to a class, and when it does, the fully qualified name of that class should be reported by passing a
* Some for suiteClassName. One use for this bit of information is JUnit integration,
* because the "name" provided to a JUnit org.junit.runner.Description appears to usually include
* a fully qualified class name by convention.
*
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the suite that has completed
* @param suiteClassName an optional fully qualifed Suite class name containing the suite that has completed
* @param duration an optional amount of time, in milliseconds, that was required to execute the suite that has completed
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param rerunner an optional Rerunner that can be used to rerun the suite that has completed (if None
* is passed, the suite cannot be rerun)
* @param payload an optional object that can be used to pass custom information to the reporter about the SuiteCompleted event
* @param threadName a name for the Thread about whose activity this event was reported
* @param timeStamp a Long indicating the time this event was reported, expressed in terms of the
* number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
*
* @author Bill Venners
*/
final case class SuiteCompleted (
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
duration: Option[Long],
formatter: Option[Formatter],
rerunner: Option[Rerunner],
payload: Option[Any],
threadName: String,
timeStamp: Long
) extends Event {
if (ordinal == null)
throw new NullPointerException("ordinal was null")
if (suiteName == null)
throw new NullPointerException("suiteName was null")
if (suiteClassName == null)
throw new NullPointerException("suiteClassName was null")
if (duration == null)
throw new NullPointerException("duration was null")
if (formatter == null)
throw new NullPointerException("formatter was null")
if (rerunner == null)
throw new NullPointerException("rerunner was null")
if (payload == null)
throw new NullPointerException("payload was null")
if (threadName == null)
throw new NullPointerException("threadName was null")
}
/**
* Companion object for the SuiteCompleted event, which contains overloaded factory methods
* and an extractor method to facilitate pattern matching on SuiteCompleted objects.
*
*
* All factory methods throw NullPointerException if any of the passed values are null.
*
*
* @author Bill Venners
*/
object SuiteCompleted {
/**
* Constructs a new SuiteCompleted event with the passed parameters, passing the current thread's
* name as threadname and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the suite that has completed
* @param suiteClassName an optional fully qualifed Suite class name containing the suite that has completed
* @param duration an optional amount of time, in milliseconds, that was required to execute the suite that has completed
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param rerunner an optional Rerunner that can be used to rerun the suite that has completed (if None
* is passed, the suite cannot be rerun)
* @param payload an optional object that can be used to pass custom information to the reporter about the SuiteCompleted event
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new SuiteCompleted instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
duration: Option[Long],
formatter: Option[Formatter],
rerunner: Option[Rerunner],
payload: Option[Any]
): SuiteCompleted = {
apply(ordinal, suiteName, suiteClassName, duration, formatter, rerunner, payload, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new SuiteCompleted event with the passed parameters, passing None as the
* payload, the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the suite that has completed
* @param suiteClassName an optional fully qualifed Suite class name containing the suite that has completed
* @param duration an optional amount of time, in milliseconds, that was required to execute the suite that has completed
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param rerunner an optional Rerunner that can be used to rerun the suite that has completed (if None
* is passed, the suite cannot be rerun)
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new SuiteCompleted instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
duration: Option[Long],
formatter: Option[Formatter],
rerunner: Option[Rerunner]
): SuiteCompleted = {
apply(ordinal, suiteName, suiteClassName, duration, formatter, rerunner, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new SuiteCompleted event with the passed parameters, passing None as the
* rerunner, None as the payload, the current threads name as threadname,
* and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the suite that has completed
* @param suiteClassName an optional fully qualifed Suite class name containing the suite that has completed
* @param duration an optional amount of time, in milliseconds, that was required to execute the suite that has completed
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new SuiteCompleted instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
duration: Option[Long],
formatter: Option[Formatter]
): SuiteCompleted = {
apply(ordinal, suiteName, suiteClassName, duration, formatter, None, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new SuiteCompleted event with the passed parameters, passing None for
* formatter, None as the rerunner, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param suiteName the name of the suite containing the suite that has completed
* @param suiteClassName an optional fully qualifed Suite class name containing the suite that has completed
* @param duration an optional amount of time, in milliseconds, that was required to execute the suite that has completed
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new SuiteCompleted instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String],
duration: Option[Long]
): SuiteCompleted = {
apply(ordinal, suiteName, suiteClassName, duration, None, None, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new SuiteCompleted event with the passed parameters, passing None for duration,
* None for formatter, None as the rerunner, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param name a localized name identifying the suite that has completed, which should include the
* suite name, suitable for presenting to the user
* @param suiteName the name of the suite containing the suite that has completed
* @param suiteClassName an optional fully qualifed Suite class name containing the suite that has completed
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new SuiteCompleted instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
suiteName: String,
suiteClassName: Option[String]
): SuiteCompleted = {
apply(ordinal, suiteName, suiteClassName, None, None, None, None, Thread.currentThread.getName, (new Date).getTime)
}
}
/**
* Event that indicates the execution of a suite of tests has aborted, likely because of an error, prior
* to completion.
*
*
* For example, trait Suite and object Runner use SuiteAborted to report
* that the execute method of a Suite
* has completed abruptly with a RuntimeException.
*
*
*
* To create instances of this class you may
* use one of the factory methods provided in its companion object. For example, given a
* report function named report, you could fire a SuiteAborted event like this:
*
*
*
* report(SuiteAborted(ordinal, userFriendlyName, message, suiteName, Some(thisSuite.getClass.getName)))
*
*
*
* The suite class name parameter is optional, because suites in ScalaTest are an abstraction that
* need not necessarily correspond to one class. Nevertheless, it most cases each suite will correspond
* to a class, and when it does, the fully qualified name of that class should be reported by passing a
* Some for suiteClassName. One use for this bit of information is JUnit integration,
* because the "name" provided to a JUnit org.junit.runner.Description appears to usually include
* a fully qualified class name by convention.
*
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param name a localized name identifying the suite that has aborted, which should include the
* suite name, suitable for presenting to the user
* @param message a localized message suitable for presenting to the user
* @param suiteName the name of the suite containing the suite that has aborted
* @param suiteClassName an optional fully qualifed Suite class name containing the suite that has aborted
* @param throwable an optional Throwable that, if a Some, indicates why the suite has aborted,
* or a Throwable created to capture stack trace information about the problem.
* @param duration an optional amount of time, in milliseconds, that was required to execute the suite that has aborted
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param rerunner an optional Rerunner that can be used to rerun the suite that has aborted (if None
* is passed, the suite cannot be rerun)
* @param payload an optional object that can be used to pass custom information to the reporter about the SuiteAborted event
* @param threadName a name for the Thread about whose activity this event was reported
* @param timeStamp a Long indicating the time this event was reported, expressed in terms of the
* number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
*
* @author Bill Venners
*/
final case class SuiteAborted (
ordinal: Ordinal,
message: String,
suiteName: String,
suiteClassName: Option[String],
throwable: Option[Throwable],
duration: Option[Long],
formatter: Option[Formatter],
rerunner: Option[Rerunner],
payload: Option[Any],
threadName: String,
timeStamp: Long
) extends Event {
if (ordinal == null)
throw new NullPointerException("ordinal was null")
if (message == null)
throw new NullPointerException("message was null")
if (suiteName == null)
throw new NullPointerException("suiteName was null")
if (suiteClassName == null)
throw new NullPointerException("suiteClassName was null")
if (throwable == null)
throw new NullPointerException("throwable was null")
if (duration == null)
throw new NullPointerException("duration was null")
if (formatter == null)
throw new NullPointerException("formatter was null")
if (rerunner == null)
throw new NullPointerException("rerunner was null")
if (payload == null)
throw new NullPointerException("payload was null")
if (threadName == null)
throw new NullPointerException("threadName was null")
}
/**
* Companion object for the SuiteAborted event, which contains overloaded factory methods
* and an extractor method to facilitate pattern matching on SuiteAborted objects.
*
*
* All factory methods throw NullPointerException if any of the passed values are null.
*
*
* @author Bill Venners
*/
object SuiteAborted {
/**
* Constructs a new SuiteAborted event with the passed parameters, passing the current thread's
* name as threadname and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param name a localized name identifying the suite that has aborted, which should include the
* suite name, suitable for presenting to the user
* @param message a localized message suitable for presenting to the user
* @param suiteName the name of the suite containing the suite that has aborted
* @param suiteClassName an optional fully qualifed Suite class name containing the suite that has aborted
* @param throwable an optional Throwable that, if a Some, indicates why the suite has aborted,
* or a Throwable created to capture stack trace information about the problem.
* @param duration an optional amount of time, in milliseconds, that was required to execute the suite that has aborted
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param rerunner an optional Rerunner that can be used to rerun the suite that has aborted (if None
* is passed, the suite cannot be rerun)
* @param payload an optional object that can be used to pass custom information to the reporter about the SuiteAborted event
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new SuiteAborted instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
message: String,
suiteName: String,
suiteClassName: Option[String],
throwable: Option[Throwable],
duration: Option[Long],
formatter: Option[Formatter],
rerunner: Option[Rerunner],
payload: Option[Any]
): SuiteAborted = {
apply(ordinal, message, suiteName, suiteClassName, throwable, duration, formatter, rerunner, payload, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new SuiteAborted event with the passed parameters, passing None as the
* payload, the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param suiteName the name of the suite containing the suite that has aborted
* @param suiteClassName an optional fully qualifed Suite class name containing the suite that has aborted
* @param throwable an optional Throwable that, if a Some, indicates why the suite has aborted,
* or a Throwable created to capture stack trace information about the problem.
* @param duration an optional amount of time, in milliseconds, that was required to execute the suite that has aborted
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param rerunner an optional Rerunner that can be used to rerun the suite that has aborted (if None
* is passed, the suite cannot be rerun)
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new SuiteAborted instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
message: String,
suiteName: String,
suiteClassName: Option[String],
throwable: Option[Throwable],
duration: Option[Long],
formatter: Option[Formatter],
rerunner: Option[Rerunner]
): SuiteAborted = {
apply(ordinal, message, suiteName, suiteClassName, throwable, duration, formatter, rerunner, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new SuiteAborted event with the passed parameters, passing None as the
* rerunner, None as the payload, the current threads name as threadname,
* and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param throwable an optional Throwable that, if a Some, indicates why the suite has aborted,
* or a Throwable created to capture stack trace information about the problem.
* @param duration an optional amount of time, in milliseconds, that was required to execute the suite that has aborted
* @param suiteName the name of the suite containing the suite that has aborted
* @param suiteClassName an optional fully qualifed Suite class name containing the suite that has aborted
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new SuiteAborted instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
message: String,
suiteName: String,
suiteClassName: Option[String],
throwable: Option[Throwable],
duration: Option[Long],
formatter: Option[Formatter]
): SuiteAborted = {
apply(ordinal, message, suiteName, suiteClassName, throwable, duration, formatter, None, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new SuiteAborted event with the passed parameters, passing None for
* formatter, None as the rerunner, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param suiteName the name of the suite containing the suite that has aborted
* @param suiteClassName an optional fully qualifed Suite class name containing the suite that has aborted
* @param throwable an optional Throwable that, if a Some, indicates why the suite has aborted,
* or a Throwable created to capture stack trace information about the problem.
* @param duration an optional amount of time, in milliseconds, that was required to execute the suite that has aborted
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new SuiteAborted instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
message: String,
suiteName: String,
suiteClassName: Option[String],
throwable: Option[Throwable],
duration: Option[Long]
): SuiteAborted = {
apply(ordinal, message, suiteName, suiteClassName, throwable, duration, None, None, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new SuiteAborted event with the passed parameters, passing None for duration,
* None for formatter, None as the rerunner, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param suiteName the name of the suite containing the suite that has aborted
* @param suiteClassName an optional fully qualifed Suite class name containing the suite that has aborted
* @param throwable an optional Throwable that, if a Some, indicates why the suite has aborted,
* or a Throwable created to capture stack trace information about the problem.
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new SuiteAborted instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
message: String,
suiteName: String,
suiteClassName: Option[String],
throwable: Option[Throwable]
): SuiteAborted = {
apply(ordinal, message, suiteName, suiteClassName, throwable, None, None, None, None, Thread.currentThread.getName, (new Date).getTime)
}
}
/**
* Event that indicates a runner is about run a suite of tests.
*
*
* For example, object Runner reports RunStarting to indicate
* that the first execute method of a run's initial Suite
* is about to be invoked.
*
*
*
* To create instances of this class you may
* use one of the factory methods provided in its companion object. For example, given a
* report function named report, you could fire a RunStarting event like this:
*
*
*
* report(RunStarting(ordinal, testCount))
*
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param testCount the number of tests expected during this run
* @param configMap a Map of key-value pairs that can be used by custom Reporters
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param payload an optional object that can be used to pass custom information to the reporter about the RunStarting event
* @param threadName a name for the Thread about whose activity this event was reported
* @param timeStamp a Long indicating the time this event was reported, expressed in terms of the
* number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
*
* @throws IllegalArgumentException if testCount is less than zero.
*
* @author Bill Venners
*/
final case class RunStarting (
ordinal: Ordinal,
testCount: Int,
configMap: Map[String, Any],
formatter: Option[Formatter],
payload: Option[Any],
threadName: String,
timeStamp: Long
) extends Event {
if (ordinal == null)
throw new NullPointerException("ordinal was null")
if (testCount < 0)
throw new IllegalArgumentException("testCount was less than zero: " + testCount)
if (configMap == null)
throw new NullPointerException("configMap was null")
if (formatter == null)
throw new NullPointerException("formatter was null")
if (payload == null)
throw new NullPointerException("payload was null")
if (threadName == null)
throw new NullPointerException("threadName was null")
}
/**
* Companion object for the RunStarting event, which contains overloaded factory methods
* and an extractor method to facilitate pattern matching on RunStarting objects.
*
*
* All factory methods throw NullPointerException if any of the passed values are null, and IllegalArgumentException if
* testCount is less than zero.
*
*
* @author Bill Venners
*/
object RunStarting {
/**
* Constructs a new RunStarting event with the passed parameters, passing the current thread's
* name as threadname and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param testCount the number of tests expected during this run
* @param configMap a Map of key-value pairs that can be used by custom Reporters
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param payload an optional object that can be used to pass custom information to the reporter about the RunStarting event
*
* @throws IllegalArgumentException if testCount is less than zero.
* @throws NullPointerException if any of the passed values are null
*
* @return a new RunStarting instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
testCount: Int,
configMap: Map[String, Any],
formatter: Option[Formatter],
payload: Option[Any]
): RunStarting = {
apply(ordinal, testCount, configMap, formatter, payload, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new RunStarting event with the passed parameters, passing None as the
* payload, the current threads name as threadname,
* and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param testCount the number of tests expected during this run
* @param configMap a Map of key-value pairs that can be used by custom Reporters
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new RunStarting instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
testCount: Int,
configMap: Map[String, Any],
formatter: Option[Formatter]
): RunStarting = {
apply(ordinal, testCount, configMap, formatter, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new RunStarting event with the passed parameters, passing None for
* formatter, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param testCount the number of tests expected during this run
* @param configMap a Map of key-value pairs that can be used by custom Reporters
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new RunStarting instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
testCount: Int,
configMap: Map[String, Any]
): RunStarting = {
apply(ordinal, testCount, configMap, None, None, Thread.currentThread.getName, (new Date).getTime)
}
}
/**
* Event that indicates a runner has completed running a suite of tests.
*
*
* Suite's execute method takes a Stopper, whose stopRequested
* method indicates a stop was requested. If true is returned by
* stopRequested while a suite of tests is running, the
* execute method should promptly
* return even if that suite hasn't finished running all of its tests.
*
*
* If a stop was requested via the Stopper.
* Runner will report RunStopped
* when the execute method of the run's starting Suite returns.
* If a stop is not requested, Runner will report RunCompleted
* when the last execute method of the run's starting Suites returns.
*
*
*
* ScalaTest's Runner fires a RunCompleted report with an empty summary, because
* the reporter is responsible for keeping track of the total number of tests reported as succeeded, failed, ignored, and pending.
* ScalaTest's internal reporter replaces the RunCompleted with a new one that is identical except that is
* has a defined summary.
*
*
*
* To create instances of this class you may
* use one of the factory methods provided in its companion object. For example, given a
* report function named report, you could fire a RunCompleted event like this:
*
*
*
* report(RunCompleted(ordinal))
*
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param duration an optional amount of time, in milliseconds, that was required by the run that has completed
* @param summary an optional summary of the number of tests that were reported as succeeded, failed, ignored, and pending
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param payload an optional object that can be used to pass custom information to the reporter about the RunCompleted event
* @param threadName a name for the Thread about whose activity this event was reported
* @param timeStamp a Long indicating the time this event was reported, expressed in terms of the
* number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
*
* @author Bill Venners
*/
final case class RunCompleted (
ordinal: Ordinal,
duration: Option[Long],
summary: Option[Summary],
formatter: Option[Formatter],
payload: Option[Any],
threadName: String,
timeStamp: Long
) extends Event {
if (ordinal == null)
throw new NullPointerException("ordinal was null")
if (duration == null)
throw new NullPointerException("duration was null")
if (summary == null)
throw new NullPointerException("summary was null")
if (formatter == null)
throw new NullPointerException("formatter was null")
if (payload == null)
throw new NullPointerException("payload was null")
if (threadName == null)
throw new NullPointerException("threadName was null")
}
/**
* Companion object for the RunCompleted event, which contains overloaded factory methods
* and an extractor method to facilitate pattern matching on RunCompleted objects.
*
*
* All factory methods throw NullPointerException if any of the passed values are null.
*
*
* @author Bill Venners
*/
object RunCompleted {
/**
* Constructs a new RunCompleted event with the passed parameters, passing the current thread's
* name as threadname and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param duration an optional amount of time, in milliseconds, that was required by the run that has completed
* @param summary an optional summary of the number of tests that were reported as succeeded, failed, ignored, and pending
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param payload an optional object that can be used to pass custom information to the reporter about the RunCompleted event
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new RunCompleted instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
duration: Option[Long],
summary: Option[Summary],
formatter: Option[Formatter],
payload: Option[Any]
): RunCompleted = {
apply(ordinal, duration, summary, formatter, payload, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new RunCompleted event with the passed parameters, passing None as the
* payload, the current threads name as threadname,
* and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param duration an optional amount of time, in milliseconds, that was required by the run that has completed
* @param summary an optional summary of the number of tests that were reported as succeeded, failed, ignored, and pending
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new RunCompleted instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
duration: Option[Long],
summary: Option[Summary],
formatter: Option[Formatter]
): RunCompleted = {
apply(ordinal, duration, summary, formatter, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new RunCompleted event with the passed parameters, passing None for
* formatter, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param duration an optional amount of time, in milliseconds, that was required by the run that has completed
* @param summary an optional summary of the number of tests that were reported as succeeded, failed, ignored, and pending
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new RunCompleted instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
duration: Option[Long],
summary: Option[Summary]
): RunCompleted = {
apply(ordinal, duration, summary, None, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new RunCompleted event with the passed parameters, passing None for summary,
* None for formatter, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param duration an optional amount of time, in milliseconds, that was required by the run that has completed
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new RunCompleted instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
duration: Option[Long]
): RunCompleted = {
apply(ordinal, duration, None, None, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new RunCompleted event with the passed parameters, passing None for duration,
* None for summary, None for formatter, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new RunCompleted instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal
): RunCompleted = {
apply(ordinal, None, None, None, None, Thread.currentThread.getName, (new Date).getTime)
}
}
/**
* Event that indicates a runner has stopped running a suite of tests prior to completion, likely
* because of a stop request.
*
*
* Suite's execute method takes a Stopper, whose stopRequested
* method indicates a stop was requested. If true is returned by
* stopRequested while a suite of tests is running, the
* execute method should promptly
* return even if that suite hasn't finished running all of its tests.
*
*
* If a stop was requested via the Stopper.
* Runner will report RunStopped
* when the execute method of the run's starting Suite returns.
* If a stop is not requested, Runner will report RunCompleted
* when the last execute method of the run's starting Suites returns.
*
*
*
* ScalaTest's Runner fires a RunStopped report with an empty summary, because
* the reporter is responsible for keeping track of the total number of tests reported as succeeded, failed, ignored, and pending.
* ScalaTest's internal reporter replaces the RunStopped with a new one that is identical except that is
* has a defined summary.
*
*
*
* To create instances of this class you may
* use one of the factory methods provided in its companion object. For example, given a
* report function named report, you could fire a RunStopped event like this:
*
*
*
* report(RunStopped(ordinal))
*
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param duration an optional amount of time, in milliseconds, that was required by the run that has stopped
* @param summary an optional summary of the number of tests that were reported as succeeded, failed, ignored, and pending
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param payload an optional object that can be used to pass custom information to the reporter about the RunStopped event
* @param threadName a name for the Thread about whose activity this event was reported
* @param timeStamp a Long indicating the time this event was reported, expressed in terms of the
* number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
*
* @author Bill Venners
*/
final case class RunStopped (
ordinal: Ordinal,
duration: Option[Long],
summary: Option[Summary],
formatter: Option[Formatter],
payload: Option[Any],
threadName: String,
timeStamp: Long
) extends Event {
if (ordinal == null)
throw new NullPointerException("ordinal was null")
if (duration == null)
throw new NullPointerException("duration was null")
if (summary == null)
throw new NullPointerException("summary was null")
if (formatter == null)
throw new NullPointerException("formatter was null")
if (payload == null)
throw new NullPointerException("payload was null")
if (threadName == null)
throw new NullPointerException("threadName was null")
}
/**
* Companion object for the RunStopped event, which contains overloaded factory methods
* and an extractor method to facilitate pattern matching on RunStopped objects.
*
*
* All factory methods throw NullPointerException if any of the passed values are null.
*
*
* @author Bill Venners
*/
object RunStopped {
/**
* Constructs a new RunStopped event with the passed parameters, passing the current thread's
* name as threadname and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param duration an optional amount of time, in milliseconds, that was required by the run that has stopped
* @param summary an optional summary of the number of tests that were reported as succeeded, failed, ignored, and pending
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param payload an optional object that can be used to pass custom information to the reporter about the RunStopped event
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new RunStopped instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
duration: Option[Long],
summary: Option[Summary],
formatter: Option[Formatter],
payload: Option[Any]
): RunStopped = {
apply(ordinal, duration, summary, formatter, payload, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new RunStopped event with the passed parameters, passing None as the
* payload, the current threads name as threadname,
* and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param duration an optional amount of time, in milliseconds, that was required by the run that has stopped
* @param summary an optional summary of the number of tests that were reported as succeeded, failed, ignored, and pending
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new RunStopped instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
duration: Option[Long],
summary: Option[Summary],
formatter: Option[Formatter]
): RunStopped = {
apply(ordinal, duration, summary, formatter, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new RunStopped event with the passed parameters, passing None for
* formatter, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param duration an optional amount of time, in milliseconds, that was required by the run that has stopped
* @param summary an optional summary of the number of tests that were reported as succeeded, failed, ignored, and pending
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new RunStopped instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
duration: Option[Long],
summary: Option[Summary]
): RunStopped = {
apply(ordinal, duration, summary, None, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new RunStopped event with the passed parameters, passing None for
* formatter, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param duration an optional amount of time, in milliseconds, that was required by the run that has stopped
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new RunStopped instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
duration: Option[Long]
): RunStopped = {
apply(ordinal, duration, None, None, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new RunStopped event with the passed parameters, passing None for duration,
* None for formatter, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new RunStopped instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal
): RunStopped = {
apply(ordinal, None, None, None, None, Thread.currentThread.getName, (new Date).getTime)
}
}
/**
* Event that indicates a runner encountered an error while attempting to run a suite of tests.
*
*
* For example, object Runner reports RunAborted if the
* execute method of any of the run's starting Suites completes
* abruptly with a Throwable.
*
*
*
* ScalaTest's Runner fires a RunAborted report with an empty summary, because
* the reporter is responsible for keeping track of the total number of tests reported as succeeded, failed, ignored, and pending.
* ScalaTest's internal reporter replaces the RunAborted with a new one that is identical except that is
* has a defined summary.
*
*
*
* To create instances of this class you may
* use one of the factory methods provided in its companion object. For example, given a
* report function named report, you could fire a RunAborted event like this:
*
*
*
* report(RunAborted(ordinal, message, Some(exception)))
*
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param throwable an optional Throwable that, if a Some, indicates why the suite has aborted,
* or a Throwable created to capture stack trace information about the problem.
* @param duration an optional amount of time, in milliseconds, that was required by the run that has aborted
* @param summary an optional summary of the number of tests that were reported as succeeded, failed, ignored, and pending
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param payload an optional object that can be used to pass custom information to the reporter about the RunAborted event
* @param threadName a name for the Thread about whose activity this event was reported
* @param timeStamp a Long indicating the time this event was reported, expressed in terms of the
* number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
*
* @author Bill Venners
*/
final case class RunAborted (
ordinal: Ordinal,
message: String,
throwable: Option[Throwable],
duration: Option[Long],
summary: Option[Summary],
formatter: Option[Formatter],
payload: Option[Any],
threadName: String,
timeStamp: Long
) extends Event {
if (ordinal == null)
throw new NullPointerException("ordinal was null")
if (message == null)
throw new NullPointerException("message was null")
if (throwable == null)
throw new NullPointerException("throwable was null")
if (duration == null)
throw new NullPointerException("duration was null")
if (summary == null)
throw new NullPointerException("summary was null")
if (formatter == null)
throw new NullPointerException("formatter was null")
if (payload == null)
throw new NullPointerException("payload was null")
if (threadName == null)
throw new NullPointerException("threadName was null")
}
/**
* Companion object for the RunAborted event, which contains overloaded factory methods
* and an extractor method to facilitate pattern matching on RunAborted objects.
*
*
* All factory methods throw NullPointerException if any of the passed values are null.
*
*
* @author Bill Venners
*/
object RunAborted {
/**
* Constructs a new RunAborted event with the passed parameters, passing the current thread's
* name as threadname and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param throwable an optional Throwable that, if a Some, indicates why the suite has aborted,
* or a Throwable created to capture stack trace information about the problem.
* @param duration an optional amount of time, in milliseconds, that was required by the run that has aborted
* @param summary an optional summary of the number of tests that were reported as succeeded, failed, ignored, and pending
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param payload an optional object that can be used to pass custom information to the reporter about the RunAborted event
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new RunAborted instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
message: String,
throwable: Option[Throwable],
duration: Option[Long],
summary: Option[Summary],
formatter: Option[Formatter],
payload: Option[Any]
): RunAborted = {
apply(ordinal, message, throwable, duration, summary, formatter, payload, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new RunAborted event with the passed parameters, passing None as the
* payload, the current threads name as threadname,
* and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param throwable an optional Throwable that, if a Some, indicates why the suite has aborted,
* or a Throwable created to capture stack trace information about the problem.
* @param duration an optional amount of time, in milliseconds, that was required by the run that has aborted
* @param summary an optional summary of the number of tests that were reported as succeeded, failed, ignored, and pending
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new RunAborted instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
message: String,
throwable: Option[Throwable],
duration: Option[Long],
summary: Option[Summary],
formatter: Option[Formatter]
): RunAborted = {
apply(ordinal, message, throwable, duration, summary, formatter, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new RunAborted event with the passed parameters, passing None for
* formatter, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param throwable an optional Throwable that, if a Some, indicates why the suite has aborted,
* or a Throwable created to capture stack trace information about the problem.
* @param duration an optional amount of time, in milliseconds, that was required by the run that has aborted
* @param summary an optional summary of the number of tests that were reported as succeeded, failed, ignored, and pending
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new RunAborted instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
message: String,
throwable: Option[Throwable],
duration: Option[Long],
summary: Option[Summary]
): RunAborted = {
apply(ordinal, message, throwable, duration, summary, None, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new RunAborted event with the passed parameters, passing None for
* formatter, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param throwable an optional Throwable that, if a Some, indicates why the suite has aborted,
* or a Throwable created to capture stack trace information about the problem.
* @param duration an optional amount of time, in milliseconds, that was required by the run that has aborted
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new RunAborted instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
message: String,
throwable: Option[Throwable],
duration: Option[Long]
): RunAborted = {
apply(ordinal, message, throwable, duration, None, None, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new RunAborted event with the passed parameters, passing None for duration,
* None for formatter, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param throwable an optional Throwable that, if a Some, indicates why the suite has aborted,
* or a Throwable created to capture stack trace information about the problem.
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new RunAborted instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
message: String,
throwable: Option[Throwable]
): RunAborted = {
apply(ordinal, message, throwable, None, None, None, None, Thread.currentThread.getName, (new Date).getTime)
}
}
/**
* Event used to provide information that is not appropriate to report via any other Event.
*
*
* To create instances of this class you may
* use one of the factory methods provided in its companion object. For example, given a
* report function named report, you could fire a InfoProvided event like this:
*
*
*
* report(InfoProvided(ordinal, message, Some(NameInfo(suiteName, Some(thisSuite.getClass.getName), Some(testName)))))
*
*
*
* An InfoProvided event may be fired from anywhere. In this respect InfoProvided is different
* from the other events, for which it is defined whether they are fired in the context of a suite or test.
* If fired in the context of a test, the InfoProvided event should include a NameInfo in which
* testName is defined. If fired in the context of a suite, but not a test, the InfoProvided event
* should include a NameInfo in which testName is not defined. If fired within the context
* of neither a suite nor a test, the nameInfo of the InfoProvided event (an Option[NameInfo]) should be None.
*
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param nameInfo an optional NameInfo that if defined, provides names for the suite and optionally the test
* in the context of which the information was provided
* @param aboutAPendingTest indicates whether the information being provided via this event is about a pending test
* @param throwable an optional Throwable
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param payload an optional object that can be used to pass custom information to the reporter about the InfoProvided event
* @param threadName a name for the Thread about whose activity this event was reported
* @param timeStamp a Long indicating the time this event was reported, expressed in terms of the
* number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
*
* @author Bill Venners
*/
final case class InfoProvided (
ordinal: Ordinal,
message: String,
nameInfo: Option[NameInfo],
aboutAPendingTest: Option[Boolean],
throwable: Option[Throwable],
formatter: Option[Formatter],
payload: Option[Any],
threadName: String,
timeStamp: Long
) extends Event {
if (ordinal == null)
throw new NullPointerException("ordinal was null")
if (message == null)
throw new NullPointerException("message was null")
if (nameInfo == null)
throw new NullPointerException("nameInfo was null")
if (throwable == null)
throw new NullPointerException("throwable was null")
if (formatter == null)
throw new NullPointerException("formatter was null")
if (payload == null)
throw new NullPointerException("payload was null")
if (threadName == null)
throw new NullPointerException("threadName was null")
}
/**
* Companion object for the InfoProvided event, which contains overloaded factory methods
* and an extractor method to facilitate pattern matching on InfoProvided objects.
*
*
* All factory methods throw NullPointerException if any of the passed values are null.
*
*
* @author Bill Venners
*/
object InfoProvided {
/**
* Constructs a new InfoProvided event with the passed parameters, passing the current thread's
* name as threadname and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param nameInfo an optional NameInfo that if defined, provides names for the suite and optionally the test
* in the context of which the information was provided
* @param aboutAPendingTest indicates whether the information being provided via this event is about a pending test
* @param throwable an optional Throwable
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
* @param payload an optional object that can be used to pass custom information to the reporter about the InfoProvided event
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new InfoProvided instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
message: String,
nameInfo: Option[NameInfo],
aboutAPendingTest: Option[Boolean],
throwable: Option[Throwable],
formatter: Option[Formatter],
payload: Option[Any]
): InfoProvided = {
apply(ordinal, message, nameInfo, aboutAPendingTest, throwable, formatter, payload, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new InfoProvided event with the passed parameters, passing None as the
* payload, the current threads name as threadname,
* and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param nameInfo an optional NameInfo that if defined, provides names for the suite and optionally the test
* in the context of which the information was provided
* @param aboutAPendingTest indicates whether the information being provided via this event is about a pending test
* @param throwable an optional Throwable
* @param formatter an optional formatter that provides extra information that can be used by reporters in determining
* how to present this event to the user
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new InfoProvided instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
message: String,
nameInfo: Option[NameInfo],
aboutAPendingTest: Option[Boolean],
throwable: Option[Throwable],
formatter: Option[Formatter]
): InfoProvided = {
apply(ordinal, message, nameInfo, aboutAPendingTest, throwable, formatter, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new InfoProvided event with the passed parameters, passing None for
* formatter, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param nameInfo an optional NameInfo that if defined, provides names for the suite and optionally the test
* in the context of which the information was provided
* @param aboutAPendingTest indicates whether the information being provided via this event is about a pending test
* @param throwable an optional Throwable
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new InfoProvided instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
message: String,
nameInfo: Option[NameInfo],
aboutAPendingTest: Option[Boolean],
throwable: Option[Throwable]
): InfoProvided = {
apply(ordinal, message, nameInfo, aboutAPendingTest, throwable, None, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new InfoProvided event with the passed parameters, passing None for
* the throwable, None for
* formatter, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param nameInfo an optional NameInfo that if defined, provides names for the suite and optionally the test
* in the context of which the information was provided
* @param aboutAPendingTest indicates whether the information being provided via this event is about a pending test
* @param throwable an optional Throwable
* * @throws NullPointerException if any of the passed values are null
*
* @return a new InfoProvided instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
message: String,
nameInfo: Option[NameInfo],
aboutAPendingTest: Option[Boolean]
): InfoProvided = {
apply(ordinal, message, nameInfo, aboutAPendingTest, None, None, None, Thread.currentThread.getName, (new Date).getTime)
}
/**
* Constructs a new InfoProvided event with the passed parameters, passing None for
* the throwable, None for
* formatter, None as the payload,
* the current threads name as threadname, and the current time as timeStamp.
*
* @param ordinal an Ordinal that can be used to place this event in order in the context of
* other events reported during the same run
* @param message a localized message suitable for presenting to the user
* @param nameInfo an optional NameInfo that if defined, provides names for the suite and optionally the test
* in the context of which the information was provided
* @param throwable an optional Throwable
*
* @throws NullPointerException if any of the passed values are null
*
* @return a new InfoProvided instance initialized with the passed and default values
*/
def apply(
ordinal: Ordinal,
message: String,
nameInfo: Option[NameInfo]
): InfoProvided = {
apply(ordinal, message, nameInfo, None, None, None, None, Thread.currentThread.getName, (new Date).getTime)
}
}