aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/java_tools/junitrunner/javatests/com/google/testing/junit
diff options
context:
space:
mode:
authorGravatar cpovirk <cpovirk@google.com>2018-03-27 08:14:58 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-03-27 08:16:26 -0700
commit0cafdfef8dcbde4aa556c93f05be85594c67656f (patch)
treea84588bf9b79d2e682f305cc41d88dc1e93b11cf /src/java_tools/junitrunner/javatests/com/google/testing/junit
parenteed7c75c5baa0e83e5915feade3ba4268b42c0f7 (diff)
Use JUnit assertions instead of Truth assertions.
The format of Truth's failure messages is about to change, which would break these tests. Alternatively, I could modify these tests to accept both the old and new Truth message formats, but ideally most tests wouldn't rely on the exact message format at all. (That suggests that an even better approach might be to just throw an exception whose message is a fixed string. That would avoid relying even on JUnit's message format, unlikely as I think that is to change.) RELNOTES: None. PiperOrigin-RevId: 190617095
Diffstat (limited to 'src/java_tools/junitrunner/javatests/com/google/testing/junit')
-rw-r--r--src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/junit4/JUnit4RunnerTest.java4
-rw-r--r--src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/testbed/InternationalCharsTest.java5
2 files changed, 5 insertions, 4 deletions
diff --git a/src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/junit4/JUnit4RunnerTest.java b/src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/junit4/JUnit4RunnerTest.java
index b8bff631eb..1e5b8246a9 100644
--- a/src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/junit4/JUnit4RunnerTest.java
+++ b/src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/junit4/JUnit4RunnerTest.java
@@ -16,6 +16,7 @@ package com.google.testing.junit.runner.junit4;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyListOf;
@@ -490,7 +491,8 @@ public class JUnit4RunnerTest {
@Test
public void testThatAlwaysFails() {
- assertThat("Test \u65E5本.").isEqualTo("Test Japan.");
+ // Use JUnit asserts instead of Truth, since Truth's message format is subject to change.
+ assertEquals("Test Japan.", "Test \u65E5本.");
}
}
diff --git a/src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/testbed/InternationalCharsTest.java b/src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/testbed/InternationalCharsTest.java
index 7d3c1c8d30..030ee35024 100644
--- a/src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/testbed/InternationalCharsTest.java
+++ b/src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/testbed/InternationalCharsTest.java
@@ -14,8 +14,6 @@
package com.google.testing.junit.runner.testbed;
-import static com.google.common.truth.Truth.assertThat;
-
import junit.framework.TestCase;
/**
@@ -24,6 +22,7 @@ import junit.framework.TestCase;
*/
public class InternationalCharsTest extends TestCase {
public void testThatAlwaysFails() {
- assertThat("Test \u65E5本.").isEqualTo("Test Japan.");
+ // Use JUnit asserts instead of Truth, since Truth's message format is subject to change.
+ assertEquals("Test Japan.", "Test \u65E5本.");
}
}