From 7d89ff1897fd36d58eeb19a8531e2951d2692b57 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Fri, 23 Jun 2023 16:14:27 -0400 Subject: [PATCH 1/3] firestore_integration_test_android.cc: clean up some comments --- .../src/android/firestore_integration_test_android.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/firestore/integration_test_internal/src/android/firestore_integration_test_android.cc b/firestore/integration_test_internal/src/android/firestore_integration_test_android.cc index 673e43d2de..6376c78b69 100644 --- a/firestore/integration_test_internal/src/android/firestore_integration_test_android.cc +++ b/firestore/integration_test_internal/src/android/firestore_integration_test_android.cc @@ -67,15 +67,13 @@ void FirestoreAndroidIntegrationTest::SetUp() { } void FirestoreAndroidIntegrationTest::TearDown() { - // Fail the test if there is a pending Java exception. Clear the pending - // exception as well so that it doesn't bleed into the next test. FailTestIfPendingException(); - - // Perform the tear-down steps of the superclass. FirestoreIntegrationTest::TearDown(); } void FirestoreAndroidIntegrationTest::FailTestIfPendingException() { + // Fail the test if there is a pending Java exception. Clear the pending + // exception as well so that it doesn't bleed into the next test. Local pending_exception = env().ClearExceptionOccurred(); if (!pending_exception) { return; @@ -86,7 +84,8 @@ void FirestoreAndroidIntegrationTest::FailTestIfPendingException() { return; } - // Fail the test since the test completed with a pending exception. + // Fail the test since the test completed with an unexpected pending + // exception. std::string pending_exception_as_string = pending_exception.ToString(env()); env().ExceptionClear(); FAIL() << "Test completed with a pending Java exception: " From 9546aaff08ff64dc14a0db19a0ca4070ee917997 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Fri, 23 Jun 2023 16:14:52 -0400 Subject: [PATCH 2/3] firestore_integration_test_android_test.cc: Remove two unnecssary calls to env.ExceptionClear() since ThrowException() looks after clearing it. --- .../src/android/firestore_integration_test_android_test.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/firestore/integration_test_internal/src/android/firestore_integration_test_android_test.cc b/firestore/integration_test_internal/src/android/firestore_integration_test_android_test.cc index 496cb78e86..5d52b277b6 100644 --- a/firestore/integration_test_internal/src/android/firestore_integration_test_android_test.cc +++ b/firestore/integration_test_internal/src/android/firestore_integration_test_android_test.cc @@ -63,7 +63,6 @@ TEST_F(FirestoreAndroidIntegrationTest, std::string debug_string = ToDebugString(object); EXPECT_EQ(debug_string, "Test Value"); - env().ExceptionClear(); } TEST_F(FirestoreAndroidIntegrationTest, @@ -75,7 +74,6 @@ TEST_F(FirestoreAndroidIntegrationTest, std::string debug_string = ToDebugString(null_reference); EXPECT_EQ(debug_string, "null"); - env().ExceptionClear(); } TEST_F(FirestoreAndroidIntegrationTest, JavaEqShouldReturnTrueForEqualObjects) { From c4fe7dcc0dd01a57bfaadbe8a9b03cefd6ea51bb Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Fri, 23 Jun 2023 16:15:43 -0400 Subject: [PATCH 3/3] task_test.cc: use RefersToSameJavaObjectAs() instead of JavaEq(exception) as it is more appropriate for what the tests are verifying. --- firestore/integration_test_internal/src/jni/task_test.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firestore/integration_test_internal/src/jni/task_test.cc b/firestore/integration_test_internal/src/jni/task_test.cc index f4dfd8ae76..fea8e53a32 100644 --- a/firestore/integration_test_internal/src/jni/task_test.cc +++ b/firestore/integration_test_internal/src/jni/task_test.cc @@ -78,7 +78,7 @@ TEST_F(TaskTest, GetResultShouldReturnTheResult) { Local actual_result = task.GetResult(env()); - ASSERT_THAT(actual_result, JavaEq(result)); + ASSERT_THAT(actual_result, RefersToSameJavaObjectAs(result)); } TEST_F(TaskTest, GetExceptionShouldReturnTheException) { @@ -87,7 +87,7 @@ TEST_F(TaskTest, GetExceptionShouldReturnTheException) { Local actual_exception = task.GetException(env()); - ASSERT_THAT(actual_exception, JavaEq(exception)); + ASSERT_THAT(actual_exception, RefersToSameJavaObjectAs(exception)); } // Tests for Task.IsComplete()