diff options
Diffstat (limited to 'src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4')
18 files changed, 20 insertions, 426 deletions
diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/BUILD b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/BUILD index b8887fc58d..bd9f7875f4 100644 --- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/BUILD +++ b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/BUILD @@ -1,18 +1,18 @@ DEFAULT_VISIBILITY = [ - "//java/com/google/testing/junit/runner:__subpackages__", - "//javatests/com/google/testing/junit/runner:__subpackages__", "//third_party/bazel/src/java_tools/junitrunner/java/com/google/testing/junit/runner:__subpackages__", "//third_party/bazel/src/java_tools/junitrunner/javatests/com/google/testing/junit/runner:__subpackages__", ] package(default_visibility = ["//src:__subpackages__"]) +# JUnit4 test runner core code. java_library( name = "junit4", srcs = glob(["*.java"]), deps = [ "//src/java_tools/junitrunner/java/com/google/testing/junit/junit4:runner", "//src/java_tools/junitrunner/java/com/google/testing/junit/runner/internal", + "//src/java_tools/junitrunner/java/com/google/testing/junit/runner/internal:junit4", "//src/java_tools/junitrunner/java/com/google/testing/junit/runner/model", "//src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding", "//src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/api", diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/CancellableRequestFactory.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/CancellableRequestFactory.java deleted file mode 100644 index 7a4a380aa0..0000000000 --- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/CancellableRequestFactory.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright 2012 The Bazel Authors. All Rights Reserved. -// -// 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 com.google.testing.junit.runner.junit4; - -import com.google.testing.junit.junit4.runner.MemoizingRequest; -import com.google.testing.junit.junit4.runner.RunNotifierWrapper; - -import javax.inject.Inject; -import javax.inject.Singleton; -import org.junit.runner.Description; -import org.junit.runner.Request; -import org.junit.runner.Runner; -import org.junit.runner.notification.RunNotifier; -import org.junit.runner.notification.StoppedByUserException; - -/** - * Creates requests that can be cancelled. - */ -@Singleton -class CancellableRequestFactory { - private boolean requestCreated; - private volatile ThreadSafeRunNotifier currentNotifier; - private volatile boolean cancelRequested = false; - - @Inject - CancellableRequestFactory() {} - - /** - * Creates a request that can be cancelled. Can only be called once. - * - * @param delegate request to wrap - */ - public Request createRequest(Request delegate) { - if (requestCreated) { - throw new IllegalStateException("a request was already created"); - } - return new MemoizingRequest(delegate) { - @Override - protected Runner createRunner(Request delegate) { - return new CancellableRunner(delegate.getRunner()); - } - }; - } - - /** - * Cancels the request created by this request factory. - */ - public void cancelRun() { - cancelRequested = true; - RunNotifier notifier = currentNotifier; - if (notifier != null) { - notifier.pleaseStop(); - } - } - - - private class CancellableRunner extends Runner { - private final Runner delegate; - - public CancellableRunner(Runner delegate) { - this.delegate = delegate; - } - - @Override - public Description getDescription() { - return delegate.getDescription(); - } - - @Override - public void run(RunNotifier notifier) { - currentNotifier = new ThreadSafeRunNotifier(notifier); - if (cancelRequested) { - currentNotifier.pleaseStop(); - } - - try { - delegate.run(currentNotifier); - } catch (StoppedByUserException e) { - if (cancelRequested) { - throw new RuntimeException("Test run interrupted", e); - } - throw e; - } - } - } - - - private static class ThreadSafeRunNotifier extends RunNotifierWrapper { - private volatile boolean stopRequested; - - public ThreadSafeRunNotifier(RunNotifier delegate) { - super(delegate); - } - - /** - * {@inheritDoc}<p> - * - * The implementation is almost an exact copy of the version in - * {@code RunNotifier} but is thread-safe. - */ - @Override - public void fireTestStarted(Description description) throws StoppedByUserException { - if (stopRequested) { - throw new StoppedByUserException(); - } - getDelegate().fireTestStarted(description); - } - - /** - * {@inheritDoc}<p> - * - * This method is thread-safe. - */ - @Override - public void pleaseStop() { - stopRequested = true; - } - } -} diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/CancellableRequestFactoryFactory.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/CancellableRequestFactoryFactory.java index 8fbd21aa40..ca90cc1b73 100644 --- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/CancellableRequestFactoryFactory.java +++ b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/CancellableRequestFactoryFactory.java @@ -14,6 +14,7 @@ package com.google.testing.junit.runner.junit4; +import com.google.testing.junit.runner.internal.junit4.CancellableRequestFactory; import com.google.testing.junit.runner.util.Factory; /** diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/CurrentRunningTestFactory.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/CurrentRunningTestFactory.java index 5043b88888..a50a7a535b 100644 --- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/CurrentRunningTestFactory.java +++ b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/CurrentRunningTestFactory.java @@ -14,6 +14,7 @@ package com.google.testing.junit.runner.junit4; +import com.google.testing.junit.runner.internal.junit4.SettableCurrentRunningTest; import com.google.testing.junit.runner.util.Factory; /** diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4Runner.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4Runner.java index 0dfd0429cf..87a2a48a2a 100644 --- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4Runner.java +++ b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4Runner.java @@ -17,6 +17,7 @@ package com.google.testing.junit.runner.junit4; import com.google.testing.junit.junit4.runner.RegExTestCaseFilter; import com.google.testing.junit.junit4.runner.SuiteTrimmingFilter; import com.google.testing.junit.runner.internal.Stdout; +import com.google.testing.junit.runner.internal.junit4.CancellableRequestFactory; import com.google.testing.junit.runner.model.TestSuiteModel; import com.google.testing.junit.runner.util.GoogleTestSecurityManager; import com.google.testing.junit.runner.util.Supplier; diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4RunnerFactory.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4RunnerFactory.java index d7db896bd6..cfb86c861e 100644 --- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4RunnerFactory.java +++ b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4RunnerFactory.java @@ -14,6 +14,7 @@ package com.google.testing.junit.runner.junit4; +import com.google.testing.junit.runner.internal.junit4.CancellableRequestFactory; import com.google.testing.junit.runner.model.TestSuiteModel; import com.google.testing.junit.runner.util.Factory; import com.google.testing.junit.runner.util.Supplier; diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4RunnerModule.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4RunnerModule.java index 1e2972bfa3..fa7a046db7 100644 --- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4RunnerModule.java +++ b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4RunnerModule.java @@ -15,6 +15,11 @@ package com.google.testing.junit.runner.junit4; import com.google.testing.junit.runner.internal.SignalHandlers; +import com.google.testing.junit.runner.internal.Xml; +import com.google.testing.junit.runner.internal.junit4.JUnit4TestNameListener; +import com.google.testing.junit.runner.internal.junit4.JUnit4TestStackTraceListener; +import com.google.testing.junit.runner.internal.junit4.JUnit4TestXmlListener; +import com.google.testing.junit.runner.internal.junit4.SettableCurrentRunningTest; import com.google.testing.junit.runner.util.TestNameProvider; import com.google.testing.junit.runner.util.Ticker; import java.io.FileNotFoundException; @@ -98,7 +103,7 @@ public final class JUnit4RunnerModule { SettableCurrentRunningTest provideCurrentRunningTest() { return new SettableCurrentRunningTest() { @Override - void setGlobalTestNameProvider(TestNameProvider provider) { + protected void setGlobalTestNameProvider(TestNameProvider provider) { testNameProvider = provider; } }; diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestNameListener.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestNameListener.java deleted file mode 100644 index e1c2c54133..0000000000 --- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestNameListener.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2011 The Bazel Authors. All Rights Reserved. -// -// 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 com.google.testing.junit.runner.junit4; - -import com.google.testing.junit.runner.util.TestNameProvider; - -import org.junit.runner.Description; -import org.junit.runner.notification.RunListener; - -import javax.inject.Inject; -import javax.inject.Singleton; - -/** - * A listener to get the name of a JUnit4 test. - */ -@Singleton -class JUnit4TestNameListener extends RunListener { - private final ThreadLocal<Description> runningTest = new ThreadLocal<>(); - private final SettableCurrentRunningTest currentRunningTest; - - @Inject - public JUnit4TestNameListener(SettableCurrentRunningTest currentRunningTest) { - this.currentRunningTest = currentRunningTest; - } - - @Override - public void testRunStarted(Description description) throws Exception { - currentRunningTest.setGlobalTestNameProvider(new TestNameProvider() { - @Override - public Description get() { - return runningTest.get(); - } - }); - } - - @Override - public void testStarted(Description description) throws Exception { - runningTest.set(description); - } - - @Override - public void testFinished(Description description) throws Exception { - runningTest.set(null); - } -} diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestNameListenerFactory.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestNameListenerFactory.java index 0c05619e7a..b12a92410d 100644 --- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestNameListenerFactory.java +++ b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestNameListenerFactory.java @@ -14,6 +14,8 @@ package com.google.testing.junit.runner.junit4; +import com.google.testing.junit.runner.internal.junit4.JUnit4TestNameListener; +import com.google.testing.junit.runner.internal.junit4.SettableCurrentRunningTest; import com.google.testing.junit.runner.util.Factory; import com.google.testing.junit.runner.util.Supplier; diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestStackTraceListener.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestStackTraceListener.java deleted file mode 100644 index 8f62b1d99f..0000000000 --- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestStackTraceListener.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2015 The Bazel Authors. All Rights Reserved. -// -// 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 com.google.testing.junit.runner.junit4; - -import com.google.testing.junit.runner.internal.SignalHandlers; -import com.google.testing.junit.runner.internal.StackTraces; -import com.google.testing.junit.runner.internal.Stderr; - -import org.junit.runner.Description; -import org.junit.runner.notification.RunListener; - -import sun.misc.Signal; -import sun.misc.SignalHandler; - -import java.io.PrintStream; - -import javax.inject.Inject; -import javax.inject.Singleton; - -/** - * A listener than dumps all stack traces when the test receives a SIGTERM. - */ -@Singleton -class JUnit4TestStackTraceListener extends RunListener { - private final SignalHandlers signalHandlers; - private final PrintStream errPrintStream; - - @Inject - public JUnit4TestStackTraceListener( - SignalHandlers signalHandlers, @Stderr PrintStream errPrintStream) { - this.signalHandlers = signalHandlers; - this.errPrintStream = errPrintStream; - } - - @Override - public void testRunStarted(Description description) throws Exception { - signalHandlers.installHandler(new Signal("TERM"), new WriteStackTraceSignalHandler()); - } - - private class WriteStackTraceSignalHandler implements SignalHandler { - @Override - public void handle(Signal signal) { - errPrintStream.println("Dumping stack traces for all threads\n"); - StackTraces.printAll(errPrintStream); - } - } -} diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestStackTraceListenerFactory.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestStackTraceListenerFactory.java index bad3e826f2..865cd687be 100644 --- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestStackTraceListenerFactory.java +++ b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestStackTraceListenerFactory.java @@ -15,6 +15,7 @@ package com.google.testing.junit.runner.junit4; import com.google.testing.junit.runner.internal.SignalHandlers; +import com.google.testing.junit.runner.internal.junit4.JUnit4TestStackTraceListener; import com.google.testing.junit.runner.util.Factory; import com.google.testing.junit.runner.util.Supplier; import java.io.PrintStream; diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestXmlListener.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestXmlListener.java deleted file mode 100644 index 5dfc76f393..0000000000 --- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestXmlListener.java +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2012 The Bazel Authors. All Rights Reserved. -// -// 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 com.google.testing.junit.runner.junit4; - -import com.google.testing.junit.runner.internal.SignalHandlers; -import com.google.testing.junit.runner.internal.Stderr; -import com.google.testing.junit.runner.model.TestSuiteModel; -import com.google.testing.junit.runner.util.Supplier; -import java.io.OutputStream; -import java.io.PrintStream; -import javax.inject.Inject; -import javax.inject.Singleton; -import org.junit.Ignore; -import org.junit.runner.Description; -import org.junit.runner.Result; -import org.junit.runner.notification.Failure; -import org.junit.runner.notification.RunListener; -import sun.misc.Signal; -import sun.misc.SignalHandler; - -/** - * A listener that writes the test output as XML. - */ -@Singleton -class JUnit4TestXmlListener extends RunListener { - private final Supplier<TestSuiteModel> modelSupplier; - private final CancellableRequestFactory requestFactory; - private final SignalHandlers signalHandlers; - private final OutputStream xmlStream; - private final PrintStream errPrintStream; - private volatile TestSuiteModel model; - - @Inject - public JUnit4TestXmlListener(Supplier<TestSuiteModel> modelSupplier, - CancellableRequestFactory requestFactory, SignalHandlers signalHandlers, - @Xml OutputStream xmlStream, @Stderr PrintStream errPrintStream) { - this.modelSupplier = modelSupplier; - this.requestFactory = requestFactory; - this.signalHandlers = signalHandlers; - this.xmlStream = xmlStream; - this.errPrintStream = errPrintStream; - } - - @Override - public void testRunStarted(Description description) throws Exception { - model = modelSupplier.get(); - signalHandlers.installHandler(new Signal("TERM"), new WriteXmlSignalHandler()); - } - - @Override - public void testStarted(Description description) throws Exception { - model.testStarted(description); - } - - @Override - public void testAssumptionFailure(Failure failure) { - model.testSkipped(failure.getDescription()); - } - - @Override - public void testFailure(Failure failure) throws Exception { - model.testFailure(failure.getDescription(), failure.getException()); - } - - @Override - public void testIgnored(Description description) throws Exception { - // TODO(bazel-team) There's a known issue in the JUnit4 ParentRunner that - // fires testIgnored on test suites that are being skipped due to an - // assumption failure. - if (isSuiteAssumptionFailure(description)) { - model.testSkipped(description); - } else { - model.testSuppressed(description); - } - } - - private boolean isSuiteAssumptionFailure(Description description) { - return description.isSuite() && description.getAnnotation(Ignore.class) == null; - } - - @Override - public void testFinished(Description description) throws Exception { - model.testFinished(description); - } - - @Override - public void testRunFinished(Result result) throws Exception { - model.writeAsXml(xmlStream); - } - - private class WriteXmlSignalHandler implements SignalHandler { - - @Override - public void handle(Signal signal) { - try { - errPrintStream.printf("%nReceived %s; writing test XML%n", signal.toString()); - requestFactory.cancelRun(); - model.testRunInterrupted(); - model.writeAsXml(xmlStream); - errPrintStream.println("Done writing test XML"); - } catch (Exception e) { - errPrintStream.println("Could not write test XML"); - e.printStackTrace(errPrintStream); - } - } - } -} diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestXmlListenerFactory.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestXmlListenerFactory.java index 7ceb2bbbf9..2ba9dd4709 100644 --- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestXmlListenerFactory.java +++ b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4TestXmlListenerFactory.java @@ -15,6 +15,8 @@ package com.google.testing.junit.runner.junit4; import com.google.testing.junit.runner.internal.SignalHandlers; +import com.google.testing.junit.runner.internal.junit4.CancellableRequestFactory; +import com.google.testing.junit.runner.internal.junit4.JUnit4TestXmlListener; import com.google.testing.junit.runner.model.TestSuiteModel; import com.google.testing.junit.runner.util.Factory; import com.google.testing.junit.runner.util.Supplier; diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/NameListenerFactory.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/NameListenerFactory.java index 2ae4d76d29..a65b96cdbf 100644 --- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/NameListenerFactory.java +++ b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/NameListenerFactory.java @@ -14,6 +14,7 @@ package com.google.testing.junit.runner.junit4; +import com.google.testing.junit.runner.internal.junit4.JUnit4TestNameListener; import com.google.testing.junit.runner.util.Factory; import com.google.testing.junit.runner.util.Supplier; import org.junit.runner.notification.RunListener; diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/SettableCurrentRunningTest.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/SettableCurrentRunningTest.java deleted file mode 100644 index 785d414148..0000000000 --- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/SettableCurrentRunningTest.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The Bazel Authors. All Rights Reserved. -// -// 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 com.google.testing.junit.runner.junit4; - -import com.google.testing.junit.runner.util.CurrentRunningTest; -import com.google.testing.junit.runner.util.TestNameProvider; - -/** - * A {@link CurrentRunningTest} variant that allows to set the testNameProvider via a method call. - */ -abstract class SettableCurrentRunningTest extends CurrentRunningTest { - abstract void setGlobalTestNameProvider(TestNameProvider provider); -} diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/StackTraceListenerFactory.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/StackTraceListenerFactory.java index 34fa2a672e..b3e2c14ad1 100644 --- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/StackTraceListenerFactory.java +++ b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/StackTraceListenerFactory.java @@ -14,6 +14,7 @@ package com.google.testing.junit.runner.junit4; +import com.google.testing.junit.runner.internal.junit4.JUnit4TestStackTraceListener; import com.google.testing.junit.runner.util.Factory; import com.google.testing.junit.runner.util.Supplier; import org.junit.runner.notification.RunListener; diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/Xml.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/Xml.java deleted file mode 100644 index 1cff1de139..0000000000 --- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/Xml.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012 The Bazel Authors. All Rights Reserved. -// -// 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 com.google.testing.junit.runner.junit4; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import javax.inject.Qualifier; - -/** - * Binding annotation that indicates that the given {@code String} or stream - * represents XML. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.PARAMETER, ElementType.METHOD}) -@Qualifier -@interface Xml { -} diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/XmlListenerFactory.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/XmlListenerFactory.java index 1dc6103159..c912996e13 100644 --- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/XmlListenerFactory.java +++ b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/XmlListenerFactory.java @@ -14,6 +14,7 @@ package com.google.testing.junit.runner.junit4; +import com.google.testing.junit.runner.internal.junit4.JUnit4TestXmlListener; import com.google.testing.junit.runner.util.Factory; import com.google.testing.junit.runner.util.Supplier; import org.junit.runner.notification.RunListener; |