@@ -44,6 +44,7 @@ using ::google::cloud::UnifiedCredentialsOption;
4444using ::google::cloud::internal::GetEnv;
4545using ::google::cloud::storage::testing::TempFile;
4646using ::google::cloud::testing_util::IsOk;
47+ using ::testing::Contains;
4748using ::testing::IsEmpty;
4849using ::testing::Not;
4950using ::testing::StartsWith;
@@ -89,6 +90,10 @@ KlXA1yQW/ClmnHVg57SN1g1rvOJCcnHBnSbT7kGFqUol
8990constexpr int kCurleAbortedByCallback = 42 ;
9091constexpr int kCurleOk = 0 ;
9192
93+ MATCHER_P (HeaderStartsWith, prefix, " header start with" ) {
94+ return absl::StartsWith (std::string{arg}, prefix);
95+ }
96+
9297class UnifiedCredentialsIntegrationTest
9398 : public ::google::cloud::storage::testing::StorageIntegrationTest {
9499 protected:
@@ -381,7 +386,7 @@ TEST_F(UnifiedCredentialsIntegrationTest, AccessToken) {
381386 ASSERT_THAT (headers, IsOk ());
382387
383388 auto constexpr kPrefix = " authorization: Bearer " ;
384- ASSERT_THAT (*headers, Contains (StartsWith (kPrefix )));
389+ ASSERT_THAT (*headers, Contains (HeaderStartsWith (kPrefix )));
385390 std::string authorization;
386391 for (auto const & h : *headers) {
387392 authorization = std::string{h};
@@ -412,7 +417,7 @@ TEST_F(UnifiedCredentialsIntegrationTest, AccessTokenCustomTrustStore) {
412417 ASSERT_THAT (headers, IsOk ());
413418
414419 auto constexpr kPrefix = " authorization: Bearer " ;
415- ASSERT_THAT (*headers, Contains (StartsWith (kPrefix )));
420+ ASSERT_THAT (*headers, Contains (HeaderStartsWith (kPrefix )));
416421 std::string authorization;
417422 for (auto const & h : *headers) {
418423 authorization = std::string{h};
@@ -446,7 +451,7 @@ TEST_F(UnifiedCredentialsIntegrationTest, AccessTokenEmptyTrustStore) {
446451 ASSERT_THAT (headers, IsOk ());
447452
448453 auto constexpr kPrefix = " authorization: Bearer " ;
449- ASSERT_THAT (*headers, Contains (StartsWith (kPrefix )));
454+ ASSERT_THAT (*headers, Contains (HeaderStartsWith (kPrefix )));
450455 std::string authorization;
451456 for (auto const & h : *headers) {
452457 authorization = std::string{h};
0 commit comments