|
16 | 16 |
|
17 | 17 | package androidx.test.internal.events.client;
|
18 | 18 |
|
19 |
| -import static org.hamcrest.MatcherAssert.assertThat; |
20 |
| -import static org.hamcrest.Matchers.is; |
| 19 | +import static com.google.common.truth.Truth.assertThat; |
21 | 20 | import static org.mockito.Mockito.verify;
|
22 | 21 |
|
| 22 | +import androidx.test.ext.junit.runners.AndroidJUnit4; |
| 23 | +import androidx.test.services.events.internal.StackTrimmer; |
23 | 24 | import androidx.test.services.events.run.TestAssumptionFailureEvent;
|
24 | 25 | import androidx.test.services.events.run.TestFailureEvent;
|
25 | 26 | import androidx.test.services.events.run.TestFinishedEvent;
|
|
39 | 40 | import org.mockito.ArgumentCaptor;
|
40 | 41 | import org.mockito.Mock;
|
41 | 42 | import org.mockito.MockitoAnnotations;
|
42 |
| -import org.robolectric.RobolectricTestRunner; |
43 | 43 |
|
44 | 44 | /** Unit tests for {@link OrchestratedInstrumentationListener}. */
|
45 |
| -@RunWith(RobolectricTestRunner.class) |
| 45 | +@RunWith(AndroidJUnit4.class) |
46 | 46 | public class OrchestratedInstrumentationListenerTest {
|
47 | 47 | @Mock TestRunEventService testRunEventService;
|
48 | 48 |
|
@@ -83,7 +83,7 @@ public void testRunFinished() throws TestEventClientException {
|
83 | 83 | verify(testRunEventService).send(argument.capture());
|
84 | 84 |
|
85 | 85 | TestRunFinishedEvent event = (TestRunFinishedEvent) argument.getValue();
|
86 |
| - assertThat(event.count, is(1)); |
| 86 | + assertThat(event.count).isEqualTo(1); |
87 | 87 | }
|
88 | 88 |
|
89 | 89 | @Test
|
@@ -151,12 +151,12 @@ public void testIgnored() throws TestEventClientException {
|
151 | 151 |
|
152 | 152 | private static void compareDescription(
|
153 | 153 | TestRunEventWithTestCase event, Description jUnitDescription) {
|
154 |
| - assertThat(event.testCase.className, is(jUnitDescription.getClassName())); |
155 |
| - assertThat(event.testCase.methodName, is(jUnitDescription.getMethodName())); |
| 154 | + assertThat(event.testCase.className).isEqualTo(jUnitDescription.getClassName()); |
| 155 | + assertThat(event.testCase.methodName).isEqualTo(jUnitDescription.getMethodName()); |
156 | 156 | }
|
157 | 157 |
|
158 | 158 | private static void compareFailure(TestFailureEvent event, Failure jUnitFailure) {
|
159 |
| - assertThat(event.failure.stackTrace, is(jUnitFailure.getTrace())); |
| 159 | + assertThat(event.failure.stackTrace).isEqualTo(StackTrimmer.getTrimmedStackTrace(jUnitFailure)); |
160 | 160 | compareDescription(event, jUnitFailure.getDescription());
|
161 | 161 | }
|
162 | 162 | }
|
0 commit comments