diff options
author | Pete Bentley <prb@google.com> | 2021-02-21 18:26:28 +0000 |
---|---|---|
committer | Pete Bentley <prb@google.com> | 2021-03-02 23:54:01 +0000 |
commit | 8e80a2a7b89329f95cb41e8b2981044362478c04 (patch) | |
tree | c863bdca20bca95fc2dcfa52c63c84b048d61751 /src/main/java/org/junit/runner/notification/RunNotifier.java | |
parent | 565f36d28118dce0c0a08fe71924dcd25e039022 (diff) | |
download | junit-8e80a2a7b89329f95cb41e8b2981044362478c04.tar.gz |
Upgrade external/junit to 4.13.2
Contains just the changes from 4.12 to 4.13.2 and undoes local
Android changes. Will re-patch those in in subsequent CLs.
This change re-lands https://r.android.com/1598413.
Bug: 129054170
Test: m
Change-Id: I6135799c8be5db2ec4c3f13951c18c072427e30d
Diffstat (limited to 'src/main/java/org/junit/runner/notification/RunNotifier.java')
-rw-r--r-- | src/main/java/org/junit/runner/notification/RunNotifier.java | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/src/main/java/org/junit/runner/notification/RunNotifier.java b/src/main/java/org/junit/runner/notification/RunNotifier.java index 6875f76..752fa3b 100644 --- a/src/main/java/org/junit/runner/notification/RunNotifier.java +++ b/src/main/java/org/junit/runner/notification/RunNotifier.java @@ -65,8 +65,8 @@ public class RunNotifier { void run() { int capacity = currentListeners.size(); - ArrayList<RunListener> safeListeners = new ArrayList<RunListener>(capacity); - ArrayList<Failure> failures = new ArrayList<Failure>(capacity); + List<RunListener> safeListeners = new ArrayList<RunListener>(capacity); + List<Failure> failures = new ArrayList<Failure>(capacity); for (RunListener listener : currentListeners) { try { notifyListener(listener); @@ -78,7 +78,7 @@ public class RunNotifier { fireTestFailures(safeListeners, failures); } - abstract protected void notifyListener(RunListener each) throws Exception; + protected abstract void notifyListener(RunListener each) throws Exception; } /** @@ -106,6 +106,41 @@ public class RunNotifier { } /** + * 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 + */ + public void fireTestSuiteStarted(final Description description) { + new SafeNotifier() { + @Override + protected void notifyListener(RunListener each) throws Exception { + each.testSuiteStarted(description); + } + }.run(); + } + + /** + * Invoke to tell listeners that a test suite is about to finish. Always invoke + * this method if you invoke {@link #fireTestSuiteStarted(Description)} + * as listeners are likely to expect them to come in pairs. + * + * @param description the description of the suite test (generally a class name) + * @since 4.13 + */ + public void fireTestSuiteFinished(final Description description) { + new SafeNotifier() { + @Override + protected void notifyListener(RunListener each) throws Exception { + each.testSuiteFinished(description); + } + }.run(); + } + + /** * Invoke to tell listeners that an atomic test is about to start. * * @param description the description of the atomic test (generally a class and method name) |