org.scalatest.junit

class JUnitWrapperSuite

[source: org/scalatest/junit/JUnitWrapperSuite.scala]

class JUnitWrapperSuite(junitClassName : java.lang.String, loader : java.lang.ClassLoader)
extends Suite

A wrapper to allow JUnit tests to be run by the ScalaTest runner.

Instances of this trait are not thread safe.

Author
Bill Venners
Daniel Watson
Joel Neely
George Berger
Method Summary
override def expectedTestCount (filter : Filter) : Int
The total number of tests that are expected to run when this Suite's run method is invoked.
def getRequest : org.junit.runner.Request
override def run (testName : scala.Option[java.lang.String], report : Reporter, stopper : Stopper, filter : Filter, config : scala.collection.immutable.Map[java.lang.String, Any], distributor : scala.Option[Distributor], tracker : Tracker) : Unit
Runs this suite of tests.
protected override final def runNestedSuites (reporter : Reporter, stopper : Stopper, filter : Filter, configMap : scala.collection.immutable.Map[java.lang.String, Any], distributor : scala.Option[Distributor], tracker : Tracker) : Unit
Throws UnsupportedOperationException, because this method is unused by this class, given this class's run method delegates to JUnit to run its tests.
protected override final def runTest (testName : java.lang.String, reporter : Reporter, stopper : Stopper, configMap : scala.collection.immutable.Map[java.lang.String, Any], tracker : Tracker) : Unit
Throws UnsupportedOperationException, because this method is unused by this class, given this class's run method delegates to JUnit to run its tests.
protected override final def runTests (testName : scala.Option[java.lang.String], reporter : Reporter, stopper : Stopper, filter : Filter, configMap : scala.collection.immutable.Map[java.lang.String, Any], distributor : scala.Option[Distributor], tracker : Tracker) : Unit
Throws UnsupportedOperationException, because this method is unused by this class, given this class's run method delegates to JUnit to run its tests.
protected override final def withFixture (test : NoArgTest) : Unit
Throws UnsupportedOperationException, because this method is unused by this class, given this class's run method delegates to JUnit to run its tests.
Methods inherited from Suite
nestedSuites, execute, execute, execute, execute, tags, groups, testNames, suiteName, pending, pendingUntilFixed
Methods inherited from Assertions
assert, assert, assert, assert, convertToEqualizer, intercept, expect, expect, fail, fail, fail, fail
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
override def run(testName : scala.Option[java.lang.String], report : Reporter, stopper : Stopper, filter : Filter, config : scala.collection.immutable.Map[java.lang.String, Any], distributor : scala.Option[Distributor], tracker : Tracker) : Unit
Runs this suite of tests.

If testName is None, this trait's implementation of this method calls these two methods on this object in this order:

  1. runNestedSuites(report, stopper, tagsToInclude, tagsToExclude, configMap, distributor)
  2. runTests(testName, report, stopper, tagsToInclude, tagsToExclude, configMap)

If testName is defined, then this trait's implementation of this method calls runTests, but does not call runNestedSuites. This behavior is part of the contract of this method. Subclasses that override run must take care not to call runNestedSuites if testName is defined. (The OneInstancePerTest trait depends on this behavior, for example.)

Subclasses and subtraits that override this run method can implement them without invoking either the runTests or runNestedSuites methods, which are invoked by this trait's implementation of this method. It is recommended, but not required, that subclasses and subtraits that override run in a way that does not invoke runNestedSuites also override runNestedSuites and make it final. Similarly it is recommended, but not required, that subclasses and subtraits that override run in a way that does not invoke runTests also override runTests (and runTest, which this trait's implementation of runTests calls) and make it final. The implementation of these final methods can either invoke the superclass implementation of the method, or throw an UnsupportedOperationException if appropriate. The reason for this recommendation is that ScalaTest includes several traits that override these methods to allow behavior to be mixed into a Suite. For example, trait BeforeAndAfterEach overrides runTestss. In a Suite subclass that no longer invokes runTests from run, the BeforeAndAfterEach trait is not applicable. Mixing it in would have no effect. By making runTests final in such a Suite subtrait, you make the attempt to mix BeforeAndAfterEach into a subclass of your subtrait a compiler error. (It would fail to compile with a complaint that BeforeAndAfterEach is trying to override runTests, which is a final method in your trait.)

Parameters
testName - an optional name of one test to run. If None, all relevant tests should be run. I.e., None acts like a wildcard that means run all relevant tests in this Suite.
reporter - the Reporter to which results will be reported
stopper - the Stopper that will be consulted to determine whether to stop execution early.
filter - a Filter with which to filter tests based on their tags
configMap - a Map of key-value pairs that can be used by the executing Suite of tests.
distributor - an optional Distributor, into which to put nested Suites to be run by another entity, such as concurrently by a pool of threads. If None, nested Suites will be run sequentially.
tracker - a Tracker tracking Ordinals being fired by the current thread.
Throws
NullPointerException - if any passed parameter is null.
IllegalArgumentException - if testName is defined, but no test with the specified test name exists in this Suite
Overrides
Suite.run

override def expectedTestCount(filter : Filter) : Int
The total number of tests that are expected to run when this Suite's run method is invoked.

This trait's implementation of this method returns the sum of:

  • the size of the testNames List, minus the number of tests marked as ignored
  • the sum of the values obtained by invoking expectedTestCount on every nested Suite contained in nestedSuites
Parameters
filter - a Filter with which to filter tests to count based on their tags
Overrides
Suite.expectedTestCount

def getRequest : org.junit.runner.Request

protected override final def withFixture(test : NoArgTest) : Unit
Throws UnsupportedOperationException, because this method is unused by this class, given this class's run method delegates to JUnit to run its tests.

The main purpose of this method implementation is to render a compiler error an attempt to mix in a trait that overrides withFixture. Because this trait does not actually use withFixture, the attempt to mix in behavior would very likely not work.

Parameters
test - the no-arg test function to run with a fixture
Overrides
Suite.withFixture

protected override final def runNestedSuites(reporter : Reporter, stopper : Stopper, filter : Filter, configMap : scala.collection.immutable.Map[java.lang.String, Any], distributor : scala.Option[Distributor], tracker : Tracker) : Unit
Throws UnsupportedOperationException, because this method is unused by this class, given this class's run method delegates to JUnit to run its tests.

The main purpose of this method implementation is to render a compiler error an attempt to mix in a trait that overrides runNestedSuites. Because this trait does not actually use runNestedSuites, the attempt to mix in behavior would very likely not work.

Parameters
reporter - the Reporter to which results will be reported
stopper - the Stopper that will be consulted to determine whether to stop execution early.
filter - a Filter with which to filter tests based on their tags
configMap - a Map of key-value pairs that can be used by the executing Suite of tests.
distributor - an optional Distributor, into which to put nested Suites to be run by another entity, such as concurrently by a pool of threads. If None, nested Suites will be run sequentially.
tracker - a Tracker tracking Ordinals being fired by the current thread.
Throws
UnsupportedOperationException - always.
Overrides
Suite.runNestedSuites

protected override final def runTests(testName : scala.Option[java.lang.String], reporter : Reporter, stopper : Stopper, filter : Filter, configMap : scala.collection.immutable.Map[java.lang.String, Any], distributor : scala.Option[Distributor], tracker : Tracker) : Unit
Throws UnsupportedOperationException, because this method is unused by this class, given this class's run method delegates to JUnit to run its tests.

The main purpose of this method implementation is to render a compiler error an attempt to mix in a trait that overrides runTests. Because this trait does not actually use runTests, the attempt to mix in behavior would very likely not work.

Parameters
testName - an optional name of one test to run. If None, all relevant tests should be run. I.e., None acts like a wildcard that means run all relevant tests in this Suite.
reporter - the Reporter to which results will be reported
stopper - the Stopper that will be consulted to determine whether to stop execution early.
filter - a Filter with which to filter tests based on their tags
configMap - a Map of key-value pairs that can be used by the executing Suite of tests.
distributor - an optional Distributor, into which to put nested Suites to be run by another entity, such as concurrently by a pool of threads. If None, nested Suites will be run sequentially.
tracker - a Tracker tracking Ordinals being fired by the current thread.
Throws
UnsupportedOperationException - always.
Overrides
Suite.runTests

protected override final def runTest(testName : java.lang.String, reporter : Reporter, stopper : Stopper, configMap : scala.collection.immutable.Map[java.lang.String, Any], tracker : Tracker) : Unit
Throws UnsupportedOperationException, because this method is unused by this class, given this class's run method delegates to JUnit to run its tests.

The main purpose of this method implementation is to render a compiler error an attempt to mix in a trait that overrides runTest. Because this trait does not actually use runTest, the attempt to mix in behavior would very likely not work.

Parameters
testName - the name of one test to run.
reporter - the Reporter to which results will be reported
stopper - the Stopper that will be consulted to determine whether to stop execution early.
configMap - a Map of key-value pairs that can be used by the executing Suite of tests.
tracker - a Tracker tracking Ordinals being fired by the current thread.
Throws
UnsupportedOperationException - always.
Overrides
Suite.runTest


Copyright (C) 2001-2009 Artima, Inc. All rights reserved.