org.scalatest.Suites.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scalatest_2.9.3 Show documentation
Show all versions of scalatest_2.9.3 Show documentation
ScalaTest is a free, open-source testing toolkit for Scala and Java
programmers.
The newest version!
/*
* Copyright 2001-2011 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
/**
* A Suite class that takes zero to many Suites,
* which will be returned from its nestedSuites method.
*
*
* For example, you can define a suite that always executes a list of
* nested suites like this:
*
*
*
* class StepsSuite extends Suites(
* new Step1Suite,
* new Step2Suite,
* new Step3Suite,
* new Step4Suite,
* new Step5Suite
* )
*
*
*
* When StepsSuite is executed, it will execute its
* nested suites in the passed order: Step1Suite, Step2Suite,
* Step3Suite, Step4Suite, and Step5Suite.
*
*
* @param suitesToNest a sequence of Suites to nest.
*
* @throws NullPointerException if suitesToNest, or any suite
* it contains, is null.
*
* @author Bill Venners
*/
class Suites(suitesToNest: Suite*) extends Suite {
for (s <- suitesToNest) {
if (s == null)
throw new NullPointerException("A passed suite was null")
}
/**
* Returns an immutable IndexedSeq containing the suites passed to the constructor in
* the order they were passed.
*/
override val nestedSuites: collection.immutable.IndexedSeq[Suite] = Vector.empty ++ suitesToNest
}
/**
* Companion object to class Suites that offers an apply factory method
* for creating a Suites instance.
*
*
* One use case for this object is to run multiple specification-style suites in the Scala interpreter, like this:
*
*
*
* scala> Suites(new MyFirstSuite, new MyNextSuite).execute()
*
*/
object Suites {
/**
* Factory method for creating a Suites instance.
*/
def apply(suitesToNest: Suite*): Suites = new Suites(suitesToNest: _*)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy