Skip to content

Commit 5112c1a

Browse files
committed
Merge branch 'Tibor17-junit.issues' into concurrent-run-listeners
Conflicts: build.xml src/main/java/org/junit/runner/notification/RunNotifier.java src/main/java/org/junit/runner/notification/SynchronizedRunListener.java src/test/java/org/junit/tests/AllTests.java
2 parents 41626fd + c220ad7 commit 5112c1a

File tree

7 files changed

+21
-11
lines changed

7 files changed

+21
-11
lines changed

Diff for: NOTICE.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
== Notices and attributions required by libraries that the project depends on ==
33
===================================================================================
44

5-
The JUnit depends on Java Hamcrest (http://hamcrest.org/JavaHamcrest/).
5+
The JUnit depends on Java Hamcrest (http://hamcrest.org/JavaHamcrest).
6+
7+
The JUnit depends on net.jcip:jcip-annotations:1.0 (http://jcip.net).

Diff for: build.xml

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
<property name="hamcrestsrc" location="${dist}/temp.hamcrest.source" />
3434
<property name="jciplib" location="lib/jcip-annotations-1.0.jar" />
3535
<property name="jciplibsources" location="lib/jcip-annotations-1.0-sources.jar" />
36+
<property name="jciplib" location="lib/jcip-annotations-1.0.jar" />
37+
<property name="jciplibsources" location="lib/jcip-annotations-1.0-sources.jar" />
3638

3739
<property name="maven.deploy.goal" value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file" />
3840

Diff for: pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@
261261
<includeDependencySources>true</includeDependencySources>
262262
<dependencySourceIncludes>
263263
<dependencySourceInclude>org.hamcrest:hamcrest-core:*</dependencySourceInclude>
264+
<dependencySourceInclude>net.jcip:jcip-annotations:*</dependencySourceInclude>
264265
</dependencySourceIncludes>
265266
</configuration>
266267
</plugin>

Diff for: src/main/java/org/junit/runner/Result.java

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.junit.runner;
22

3+
import net.jcip.annotations.ThreadSafe;
34
import org.junit.runner.notification.Failure;
45
import org.junit.runner.notification.RunListener;
56

@@ -65,6 +66,7 @@ public boolean wasSuccessful() {
6566
return getFailureCount() == 0;
6667
}
6768

69+
@ThreadSafe
6870
private class Listener extends RunListener {
6971
@Override
7072
public void testRunStarted(Description description) throws Exception {

Diff for: src/main/java/org/junit/runner/notification/RunNotifier.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void run() {
7777
* Do not invoke.
7878
*/
7979
public void fireTestRunStarted(final Description description) {
80-
new SafeNotifier(fListeners) {
80+
new SafeNotifier() {
8181
@Override
8282
protected void notifyListener(RunListener each) throws Exception {
8383
each.testRunStarted(description);

Diff for: src/main/java/org/junit/runner/notification/SynchronizedRunListener.java

+11-8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import java.lang.annotation.Annotation;
44

5+
import net.jcip.annotations.ThreadSafe;
6+
57
import org.junit.runner.Description;
68
import org.junit.runner.Result;
79

@@ -13,8 +15,9 @@
1315
* @version 4.12
1416
* @since 4.12
1517
*/
18+
@ThreadSafe
1619
final class SynchronizedRunListener extends RunListener {
17-
private static final Object fMonitor = new Object();
20+
private static final Object sMonitor = new Object();
1821
private final RunListener fListener;
1922

2023
public static RunListener wrapIfNotThreadSafe(RunListener listener) {
@@ -32,49 +35,49 @@ public static RunListener wrapIfNotThreadSafe(RunListener listener) {
3235

3336
@Override
3437
public void testRunStarted(Description description) throws Exception {
35-
synchronized (fMonitor) {
38+
synchronized (sMonitor) {
3639
fListener.testRunStarted(description);
3740
}
3841
}
3942

4043
@Override
4144
public void testRunFinished(Result result) throws Exception {
42-
synchronized (fMonitor) {
45+
synchronized (sMonitor) {
4346
fListener.testRunFinished(result);
4447
}
4548
}
4649

4750
@Override
4851
public void testStarted(Description description) throws Exception {
49-
synchronized (fMonitor) {
52+
synchronized (sMonitor) {
5053
fListener.testStarted(description);
5154
}
5255
}
5356

5457
@Override
5558
public void testFinished(Description description) throws Exception {
56-
synchronized (fMonitor) {
59+
synchronized (sMonitor) {
5760
fListener.testFinished(description);
5861
}
5962
}
6063

6164
@Override
6265
public void testFailure(Failure failure) throws Exception {
63-
synchronized (fMonitor) {
66+
synchronized (sMonitor) {
6467
fListener.testFailure(failure);
6568
}
6669
}
6770

6871
@Override
6972
public void testAssumptionFailure(Failure failure) {
70-
synchronized (fMonitor) {
73+
synchronized (sMonitor) {
7174
fListener.testAssumptionFailure(failure);
7275
}
7376
}
7477

7578
@Override
7679
public void testIgnored(Description description) throws Exception {
77-
synchronized (fMonitor) {
80+
synchronized (sMonitor) {
7881
fListener.testIgnored(description);
7982
}
8083
}

Diff for: src/test/java/org/junit/tests/AllTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import org.junit.internal.matchers.StacktracePrintingMatcherTest;
77
import org.junit.runner.RunWith;
88
import org.junit.runner.notification.AddRemoveListenerTest;
9-
import org.junit.runner.notification.RunNotifierTest;
109
import org.junit.runner.notification.ConcurrentRunNotifierTest;
10+
import org.junit.runner.notification.RunNotifierTest;
1111
import org.junit.runner.notification.SynchronizedRunListenerTest;
1212
import org.junit.runners.Suite;
1313
import org.junit.runners.Suite.SuiteClasses;

0 commit comments

Comments
 (0)