Skip to content

Commit

Permalink
Update Javadoc for fireTestSuiteStarted(), fireTestSuiteFinished(),
Browse files Browse the repository at this point in the history
testSuiteStarted() and testSuiteFinished() to make it clear that
not all runners call these methods, but runners that call
the started methods should also call the finished methods.

Closes junit-team#1118
  • Loading branch information
kcooney committed Jun 1, 2016
1 parent f4a13cb commit dc43a04
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/main/java/org/junit/runner/notification/RunListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,14 @@ public void testRunFinished(Result result) throws Exception {
}

/**
* Called when a test suite is about to be started.
* Called when a test suite is about to be started. If this method is
* called for a given {@link Description}, then {@link #testSuiteFinished(Description)}
* will also be called for the same {@code Description}.
*
* <p>Note that not all runners will call this method, so runners should
* be prepared to handle {@link #testStarted(Description)} calls for tests
* where there was no cooresponding {@code testSuiteStarted()} call for
* the parent {@code Description}.
*
* @param description the description of the test suite that is about to be run
* (generally a class name)
Expand All @@ -81,6 +88,8 @@ public void testSuiteStarted(Description description) throws Exception {

/**
* Called when a test suite has finished, whether the test suite succeeds or fails.
* This method will not be called for a given {@link Description} unless
* {@link #testSuiteStarted(Description)} was called for the same @code Description}.
*
* @param description the description of the test suite that just ran
* @since 4.13
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/org/junit/runner/notification/RunNotifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ protected void notifyListener(RunListener each) throws Exception {
}

/**
* Invoke to tell listeners that a test suite is about to start.
* Invoke to tell listeners that a test suite is about to start. Runners are strongly
* encouraged--but not required--to call this method. If this method is called for
* a given {@link Description} then {@link #fireTestSuiteFinished(Description)} MUST
* be called for the same {@code Description}.
*
* @param description the description of the suite test (generally a class name)
* @since 4.13
Expand Down

0 comments on commit dc43a04

Please sign in to comment.