1919#include " firebase/firestore.h"
2020#include " firestore_integration_test.h"
2121#include " util/event_accumulator.h"
22+ #include " util/future_test_util.h"
2223#if defined(__ANDROID__)
2324#include " firestore/src/android/write_batch_android.h"
2425#include " firestore/src/common/wrapper_assertions.h"
@@ -145,7 +146,7 @@ TEST_F(WriteBatchTest, TestBatchesCommitAtomicallyRaisingCorrectEvents) {
145146 EventAccumulator<QuerySnapshot> accumulator;
146147 accumulator.listener ()->AttachTo (&collection, MetadataChanges::kInclude );
147148 QuerySnapshot initial_snapshot = accumulator.Await ();
148- EXPECT_TRUE ( 0 == initial_snapshot.size ());
149+ EXPECT_EQ ( initial_snapshot.size (), 0 );
149150
150151 // Atomically write two documents.
151152 Await (TestFirestore ()
@@ -176,7 +177,7 @@ TEST_F(WriteBatchTest, TestBatchesFailAtomicallyRaisingCorrectEvents) {
176177 EventAccumulator<QuerySnapshot> accumulator;
177178 accumulator.listener ()->AttachTo (&collection, MetadataChanges::kInclude );
178179 QuerySnapshot initial_snapshot = accumulator.Await ();
179- EXPECT_TRUE ( 0 == initial_snapshot.size ());
180+ EXPECT_EQ ( initial_snapshot.size (), 0 );
180181
181182 // Atomically write 1 document and update a nonexistent document.
182183 Future<void > future =
@@ -186,8 +187,10 @@ TEST_F(WriteBatchTest, TestBatchesFailAtomicallyRaisingCorrectEvents) {
186187 .Update (doc_b, MapFieldValue{{" b" , FieldValue::Integer (2 )}})
187188 .Commit ();
188189 Await (future);
189- EXPECT_TRUE (FutureStatus::kFutureStatusComplete == future.status ());
190- EXPECT_TRUE (Error::kErrorNotFound == future.error ());
190+ EXPECT_EQ (future.status (), FutureStatus::kFutureStatusComplete )
191+ << ToEnumeratorName (future.status ());
192+ EXPECT_EQ (future.error (), Error::kErrorNotFound )
193+ << ToFirestoreErrorCodeName (future.error ());
191194
192195 // Local event with the set document.
193196 QuerySnapshot local_snapshot = accumulator.Await ();
@@ -199,7 +202,7 @@ TEST_F(WriteBatchTest, TestBatchesFailAtomicallyRaisingCorrectEvents) {
199202 // Server event with the set reverted
200203 QuerySnapshot server_snapshot = accumulator.Await ();
201204 EXPECT_FALSE (server_snapshot.metadata ().has_pending_writes ());
202- EXPECT_TRUE ( 0 == server_snapshot.size ());
205+ EXPECT_EQ ( server_snapshot.size (), 0 );
203206}
204207
205208TEST_F (WriteBatchTest, TestWriteTheSameServerTimestampAcrossWrites) {
@@ -209,7 +212,7 @@ TEST_F(WriteBatchTest, TestWriteTheSameServerTimestampAcrossWrites) {
209212 EventAccumulator<QuerySnapshot> accumulator;
210213 accumulator.listener ()->AttachTo (&collection, MetadataChanges::kInclude );
211214 QuerySnapshot initial_snapshot = accumulator.Await ();
212- EXPECT_TRUE ( 0 == initial_snapshot.size ());
215+ EXPECT_EQ ( initial_snapshot.size (), 0 );
213216
214217 // Atomically write two documents with server timestamps.
215218 Await (TestFirestore ()
@@ -227,9 +230,9 @@ TEST_F(WriteBatchTest, TestWriteTheSameServerTimestampAcrossWrites) {
227230
228231 QuerySnapshot server_snapshot = accumulator.AwaitRemoteEvent ();
229232 EXPECT_FALSE (server_snapshot.metadata ().has_pending_writes ());
230- EXPECT_TRUE ( 2 == server_snapshot.size ());
233+ ASSERT_EQ ( server_snapshot.size (), 2 );
231234 const FieldValue when = server_snapshot.documents ()[0 ].Get (" when" );
232- EXPECT_TRUE ( FieldValue::Type::kTimestamp == when. type () );
235+ EXPECT_EQ (when. type (), FieldValue::Type::kTimestamp );
233236 EXPECT_THAT (QuerySnapshotToValues (server_snapshot),
234237 testing::ElementsAre (MapFieldValue{{" when" , when}},
235238 MapFieldValue{{" when" , when}}));
@@ -261,7 +264,7 @@ TEST_F(WriteBatchTest, TestCanWriteTheSameDocumentMultipleTimes) {
261264 DocumentSnapshot server_snapshot = accumulator.Await ();
262265 EXPECT_FALSE (server_snapshot.metadata ().has_pending_writes ());
263266 const FieldValue when = server_snapshot.Get (" when" );
264- EXPECT_TRUE ( FieldValue::Type::kTimestamp == when. type () );
267+ EXPECT_EQ (when. type (), FieldValue::Type::kTimestamp );
265268 EXPECT_THAT (server_snapshot.GetData (),
266269 testing::ContainerEq (MapFieldValue{{" a" , FieldValue::Integer (1 )},
267270 {" b" , FieldValue::Integer (2 )},
0 commit comments