diff options
author | 2016-08-24 15:03:39 +0000 | |
---|---|---|
committer | 2016-08-24 20:01:28 +0000 | |
commit | 2dddbeeac25ace6f53dd3ce6ac588111c239bdf0 (patch) | |
tree | 3ac6aee153986e602f2ee94407a84f212d60ff1d /src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4Runner.java | |
parent | 7e2739074d84937771aa96857a1ae01e7b7f851c (diff) |
Removing some of GUAVA dependencies from junit.runner.junit4 and -.model
Bazel users that are using a different Guava version than the one in the
junitrunner jar are getting an IncompatibleClassChangeError. Rewriting
parts of junitrunner code so it won't depend on Guava anymore.
Continuing progress on issue #1150.
--
MOS_MIGRATED_REVID=131172156
Diffstat (limited to 'src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4Runner.java')
-rw-r--r-- | src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4/JUnit4Runner.java | 10 |
1 files changed, 6 insertions, 4 deletions
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 10447a7b70..d9938c7951 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 @@ -14,9 +14,7 @@ package com.google.testing.junit.runner.junit4; -import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Supplier; -import com.google.common.io.Files; import com.google.testing.junit.junit4.runner.SuiteTrimmingFilter; import com.google.testing.junit.runner.internal.Stdout; import com.google.testing.junit.runner.model.TestSuiteModel; @@ -34,6 +32,7 @@ import org.junit.runner.notification.RunListener; import org.junit.runner.notification.RunNotifier; import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; import java.util.Set; @@ -130,7 +129,10 @@ public class JUnit4Runner { private static void exitFileActive(@Nullable File file) { if (file != null) { try { - Files.write(new byte[0], file); + // Overwrite file content. + FileOutputStream outputStream = new FileOutputStream(file, false); + outputStream.write(new byte[0]); + outputStream.close(); } catch (IOException e) { throw new RuntimeException("Could not write exit file at " + file, e); } @@ -148,7 +150,7 @@ public class JUnit4Runner { } } - @VisibleForTesting + // VisibleForTesting TestSuiteModel getModel() { return modelSupplier.get(); } |