Skip to content

Commit 9f256b7

Browse files
authored
cleanup: use wildcard matcher (_) even more sparingly (#6269)
A small followup to #6263.
1 parent 7b26393 commit 9f256b7

File tree

5 files changed

+12
-17
lines changed

5 files changed

+12
-17
lines changed

generator/integration_tests/golden/tests/golden_kitchen_sink_logging_decorator_test.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ inline namespace GOOGLE_CLOUD_CPP_GENERATED_NS {
2727
namespace {
2828

2929
using ::google::cloud::testing_util::IsOk;
30-
using ::testing::_;
3130
using ::testing::ByMove;
3231
using ::testing::Contains;
3332
using ::testing::HasSubstr;

generator/integration_tests/golden/tests/golden_thing_admin_logging_decorator_test.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ namespace golden_internal {
2525
inline namespace GOOGLE_CLOUD_CPP_GENERATED_NS {
2626
namespace {
2727

28-
using ::testing::_;
2928
using ::testing::Contains;
3029
using ::testing::HasSubstr;
3130
using ::testing::Return;

google/cloud/bigtable/testing/mock_async_failing_rpc_factory.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ struct MockAsyncFailingRpcFactory {
5656
grpc::ClientContext* context,
5757
RequestType const& request,
5858
grpc::CompletionQueue*) {
59-
using ::testing::_;
6059
EXPECT_STATUS_OK(google::cloud::testing_util::IsContextMDValid(
6160
*context, method, google::cloud::internal::ApiClientHeader()));
6261
RequestType expected;
@@ -68,7 +67,7 @@ struct MockAsyncFailingRpcFactory {
6867
differencer.ReportDifferencesToString(&delta);
6968
EXPECT_TRUE(differencer.Compare(expected, request)) << delta;
7069

71-
EXPECT_CALL(*reader, Finish(_, _, _))
70+
EXPECT_CALL(*reader, Finish)
7271
.WillOnce([](ResponseType* response, grpc::Status* status, void*) {
7372
EXPECT_NE(nullptr, response);
7473
*status = grpc::Status(grpc::StatusCode::PERMISSION_DENIED, "nooo");

google/cloud/spanner/samples/mock_execute_query.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
namespace {
2525

2626
//! [helper-aliases]
27-
using ::testing::_;
2827
using ::testing::Return;
2928
namespace spanner = ::google::cloud::spanner;
3029
//! [helper-aliases]
@@ -76,7 +75,7 @@ TEST(MockSpannerClient, SuccessfulExecuteQuery) {
7675

7776
// Setup the connection mock to return the results previously setup:
7877
//! [mock-execute-query]
79-
EXPECT_CALL(*conn, ExecuteQuery(_))
78+
EXPECT_CALL(*conn, ExecuteQuery)
8079
.WillOnce([&source](spanner::Connection::SqlParams const&)
8180
-> spanner::RowStream {
8281
return spanner::RowStream(std::move(source));

google/cloud/storage/examples/storage_client_mock_samples.cc

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
namespace {
2626

27-
using ::testing::_;
2827
using ::testing::Return;
2928
using ::testing::ReturnRef;
3029

@@ -52,7 +51,7 @@ TEST(StorageMockingSamples, MockReadObject) {
5251
return gcs::internal::ReadSourceResult{
5352
l, gcs::internal::HttpResponse{200, {}, {}}};
5453
};
55-
EXPECT_CALL(*mock, ReadObject(_))
54+
EXPECT_CALL(*mock, ReadObject)
5655
.WillOnce([simulate_read](
5756
gcs::internal::ReadObjectRangeRequest const& request) {
5857
EXPECT_EQ(request.bucket_name(), "mock-bucket-name") << request;
@@ -61,7 +60,7 @@ TEST(StorageMockingSamples, MockReadObject) {
6160
EXPECT_CALL(*mock_source, IsOpen())
6261
.WillOnce(Return(true))
6362
.WillRepeatedly(Return(false));
64-
EXPECT_CALL(*mock_source, Read(_, _)).WillRepeatedly(simulate_read);
63+
EXPECT_CALL(*mock_source, Read).WillRepeatedly(simulate_read);
6564

6665
return google::cloud::make_status_or(
6766
std::unique_ptr<gcs::internal::ObjectReadSource>(
@@ -93,7 +92,7 @@ TEST(StorageMockingSamples, MockWriteObject) {
9392

9493
gcs::ObjectMetadata expected_metadata;
9594

96-
EXPECT_CALL(*mock, CreateResumableSession(_))
95+
EXPECT_CALL(*mock, CreateResumableSession)
9796
.WillOnce([&expected_metadata](
9897
gcs::internal::ResumableUploadRequest const& request) {
9998
EXPECT_EQ(request.bucket_name(), "mock-bucket-name") << request;
@@ -102,14 +101,14 @@ TEST(StorageMockingSamples, MockWriteObject) {
102101
EXPECT_CALL(*mock_result, done()).WillRepeatedly(Return(false));
103102
EXPECT_CALL(*mock_result, next_expected_byte())
104103
.WillRepeatedly(Return(0));
105-
EXPECT_CALL(*mock_result, UploadChunk(_))
104+
EXPECT_CALL(*mock_result, UploadChunk)
106105
.WillRepeatedly(Return(google::cloud::make_status_or(
107106
ResumableUploadResponse{"fake-url",
108107
0,
109108
{},
110109
ResumableUploadResponse::kInProgress,
111110
{}})));
112-
EXPECT_CALL(*mock_result, UploadFinalChunk(_, _))
111+
EXPECT_CALL(*mock_result, UploadFinalChunk)
113112
.WillRepeatedly(Return(google::cloud::make_status_or(
114113
ResumableUploadResponse{"fake-url",
115114
0,
@@ -143,14 +142,14 @@ TEST(StorageMockingSamples, MockReadObjectFailure) {
143142
auto client = gcs::testing::ClientFromMock(mock);
144143

145144
std::string text = "this is a mock http response";
146-
EXPECT_CALL(*mock, ReadObject(_))
145+
EXPECT_CALL(*mock, ReadObject)
147146
.WillOnce([](gcs::internal::ReadObjectRangeRequest const& request) {
148147
EXPECT_EQ(request.bucket_name(), "mock-bucket-name") << request;
149148
auto* mock_source = new gcs::testing::MockObjectReadSource;
150149
EXPECT_CALL(*mock_source, IsOpen())
151150
.WillOnce(Return(true))
152151
.WillRepeatedly(Return(false));
153-
EXPECT_CALL(*mock_source, Read(_, _))
152+
EXPECT_CALL(*mock_source, Read)
154153
.WillOnce(Return(google::cloud::Status(
155154
google::cloud::StatusCode::kInvalidArgument,
156155
"Invalid Argument")));
@@ -180,19 +179,19 @@ TEST(StorageMockingSamples, MockWriteObjectFailure) {
180179

181180
auto client = gcs::testing::ClientFromMock(mock);
182181

183-
EXPECT_CALL(*mock, CreateResumableSession(_))
182+
EXPECT_CALL(*mock, CreateResumableSession)
184183
.WillOnce([](gcs::internal::ResumableUploadRequest const& request) {
185184
EXPECT_EQ(request.bucket_name(), "mock-bucket-name") << request;
186185
auto* mock_result = new gcs::testing::MockResumableUploadSession;
187186
using gcs::internal::ResumableUploadResponse;
188187
EXPECT_CALL(*mock_result, done()).WillRepeatedly(Return(false));
189188
EXPECT_CALL(*mock_result, next_expected_byte())
190189
.WillRepeatedly(Return(0));
191-
EXPECT_CALL(*mock_result, UploadChunk(_))
190+
EXPECT_CALL(*mock_result, UploadChunk)
192191
.WillRepeatedly(Return(google::cloud::Status(
193192
google::cloud::StatusCode::kInvalidArgument,
194193
"Invalid Argument")));
195-
EXPECT_CALL(*mock_result, UploadFinalChunk(_, _))
194+
EXPECT_CALL(*mock_result, UploadFinalChunk)
196195
.WillRepeatedly(Return(google::cloud::Status(
197196
google::cloud::StatusCode::kInvalidArgument,
198197
"Invalid Argument")));

0 commit comments

Comments
 (0)