Skip to content

Commit 0d56e60

Browse files
committed
refactor: replace Assert.assertThat with Truth.assertThat
1 parent cce0a9b commit 0d56e60

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

runner/AndroidTestOrchestratorSample/app/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,6 @@ dependencies {
3939
androidTestImplementation 'androidx.test:monitor:' + rootProject.monitorVersion;
4040
androidTestImplementation 'androidx.test.espresso:espresso-core:' + rootProject.espressoVersion;
4141
androidTestUtil 'androidx.test:orchestrator:' + rootProject.orchestratorVersion;
42+
43+
androidTestImplementation 'com.google.truth:truth:' + rootProject.truthVersion;
4244
}

runner/AndroidTestOrchestratorSample/app/src/androidTest/java/com/example/android/testing/androidtestorchestratorsample/CalculatorAddParameterizedTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package com.example.android.testing.androidtestorchestratorsample;
1818

19+
import static com.google.common.truth.Truth.assertThat;
20+
1921
import org.junit.Before;
2022
import org.junit.Test;
2123
import org.junit.runner.RunWith;
@@ -26,9 +28,6 @@
2628
import java.lang.Iterable;
2729
import java.util.Arrays;
2830

29-
import static org.hamcrest.CoreMatchers.equalTo;
30-
import static org.hamcrest.CoreMatchers.is;
31-
import static org.junit.Assert.assertThat;
3231
import static org.junit.runners.Parameterized.Parameters;
3332

3433

@@ -88,6 +87,6 @@ public void setUp() {
8887
@Test
8988
public void testAdd_TwoNumbers() {
9089
double resultAdd = mCalculator.add(mOperandOne, mOperandTwo);
91-
assertThat(resultAdd, is(equalTo(mExpectedResult)));
90+
assertThat(resultAdd).isEqualTo(mExpectedResult);
9291
}
9392
}

runner/AndroidTestOrchestratorSample/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ ext {
3434
rulesVersion = "1.4.1-alpha05"
3535
espressoVersion = "3.5.0-alpha05"
3636
orchestratorVersion = "1.4.2-alpha02"
37+
truthVersion = "1.1.3"
3738
}

0 commit comments

Comments
 (0)