Skip to content

Commit 7fad544

Browse files
authored
Firestore: Various small improvements to the Android integration tests (#1359)
1 parent 6068798 commit 7fad544

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

firestore/integration_test_internal/src/android/firestore_integration_test_android.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,13 @@ void FirestoreAndroidIntegrationTest::SetUp() {
6767
}
6868

6969
void FirestoreAndroidIntegrationTest::TearDown() {
70-
// Fail the test if there is a pending Java exception. Clear the pending
71-
// exception as well so that it doesn't bleed into the next test.
7270
FailTestIfPendingException();
73-
74-
// Perform the tear-down steps of the superclass.
7571
FirestoreIntegrationTest::TearDown();
7672
}
7773

7874
void FirestoreAndroidIntegrationTest::FailTestIfPendingException() {
75+
// Fail the test if there is a pending Java exception. Clear the pending
76+
// exception as well so that it doesn't bleed into the next test.
7977
Local<Throwable> pending_exception = env().ClearExceptionOccurred();
8078
if (!pending_exception) {
8179
return;
@@ -86,7 +84,8 @@ void FirestoreAndroidIntegrationTest::FailTestIfPendingException() {
8684
return;
8785
}
8886

89-
// Fail the test since the test completed with a pending exception.
87+
// Fail the test since the test completed with an unexpected pending
88+
// exception.
9089
std::string pending_exception_as_string = pending_exception.ToString(env());
9190
env().ExceptionClear();
9291
FAIL() << "Test completed with a pending Java exception: "

firestore/integration_test_internal/src/android/firestore_integration_test_android_test.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ TEST_F(FirestoreAndroidIntegrationTest,
6363
std::string debug_string = ToDebugString(object);
6464

6565
EXPECT_EQ(debug_string, "Test Value");
66-
env().ExceptionClear();
6766
}
6867

6968
TEST_F(FirestoreAndroidIntegrationTest,
@@ -75,7 +74,6 @@ TEST_F(FirestoreAndroidIntegrationTest,
7574
std::string debug_string = ToDebugString(null_reference);
7675

7776
EXPECT_EQ(debug_string, "null");
78-
env().ExceptionClear();
7977
}
8078

8179
TEST_F(FirestoreAndroidIntegrationTest, JavaEqShouldReturnTrueForEqualObjects) {

firestore/integration_test_internal/src/jni/task_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ TEST_F(TaskTest, GetResultShouldReturnTheResult) {
7878

7979
Local<Object> actual_result = task.GetResult(env());
8080

81-
ASSERT_THAT(actual_result, JavaEq(result));
81+
ASSERT_THAT(actual_result, RefersToSameJavaObjectAs(result));
8282
}
8383

8484
TEST_F(TaskTest, GetExceptionShouldReturnTheException) {
@@ -87,7 +87,7 @@ TEST_F(TaskTest, GetExceptionShouldReturnTheException) {
8787

8888
Local<Throwable> actual_exception = task.GetException(env());
8989

90-
ASSERT_THAT(actual_exception, JavaEq(exception));
90+
ASSERT_THAT(actual_exception, RefersToSameJavaObjectAs(exception));
9191
}
9292

9393
// Tests for Task.IsComplete()

0 commit comments

Comments
 (0)