15 #ifndef GOOGLE_CLOUD_CPP_SPANNER_GOOGLE_CLOUD_SPANNER_TESTING_MATCHERS_H_ 16 #define GOOGLE_CLOUD_CPP_SPANNER_GOOGLE_CLOUD_SPANNER_TESTING_MATCHERS_H_ 18 #include "google/cloud/spanner/internal/session_holder.h" 21 #include <google/protobuf/util/message_differencer.h> 22 #include <gmock/gmock.h> 27 namespace spanner_testing {
32 google::protobuf::util::MessageDifferencer differencer;
33 differencer.ReportDifferencesToString(&delta);
34 auto const result = differencer.Compare(arg, value);
35 *result_listener <<
"\n" << delta;
41 HasSessionAndTransactionId, session_id, transaction_id,
42 "Verifies a Transaction has the expected Session and Transaction IDs") {
43 return google::cloud::spanner::internal::Visit(
44 arg, [&](google::cloud::spanner::internal::SessionHolder& session,
45 google::spanner::v1::TransactionSelector& s, std::int64_t) {
47 if (session.session_name() != session_id) {
48 *result_listener <<
"Session ID mismatch: " << session.session_name()
49 <<
" != " << session_id;
52 if (s.id() != transaction_id) {
53 *result_listener <<
"Transaction ID mismatch: " << s.id()
54 <<
" != " << transaction_id;
66 #endif // GOOGLE_CLOUD_CPP_SPANNER_GOOGLE_CLOUD_SPANNER_TESTING_MATCHERS_H_ MATCHER_P(IsProtoEqual, value, "")
MATCHER_P2(HasSessionAndTransactionId, session_id, transaction_id, "Verifies a Transaction has the expected Session and Transaction IDs")
Verifies a Transaction has the expected Session and Transaction IDs.
#define SPANNER_CLIENT_NS