diff --git a/cpp/src/parquet/column_writer_test.cc b/cpp/src/parquet/column_writer_test.cc index a40e71ce30ae..86fe0965a6a7 100644 --- a/cpp/src/parquet/column_writer_test.cc +++ b/cpp/src/parquet/column_writer_test.cc @@ -483,7 +483,6 @@ using TestByteArrayValuesWriter = TestPrimitiveWriter; using TestFixedLengthByteArrayValuesWriter = TestPrimitiveWriter; using ::testing::HasSubstr; -using ::testing::ThrowsMessage; TYPED_TEST(TestPrimitiveWriter, RequiredPlain) { this->TestRequiredWithEncoding(Encoding::PLAIN); @@ -918,20 +917,27 @@ TEST(TestPageWriter, ThrowsOnPagesTooLarge) { DataPageV1 over_compressed_limit(buffer, /*num_values=*/100, Encoding::BIT_PACKED, Encoding::BIT_PACKED, Encoding::BIT_PACKED, /*uncompressed_size=*/100); - EXPECT_THAT([&]() { pager->WriteDataPage(over_compressed_limit); }, - ThrowsMessage(HasSubstr("overflows INT32_MAX"))); + EXPECT_THROW_THAT([&]() { pager->WriteDataPage(over_compressed_limit); }, + ParquetException, + ::testing::Property(&ParquetException::what, + ::testing::HasSubstr("overflows INT32_MAX"))); DictionaryPage dictionary_over_compressed_limit(buffer, /*num_values=*/100, Encoding::PLAIN); - EXPECT_THAT([&]() { pager->WriteDictionaryPage(dictionary_over_compressed_limit); }, - ThrowsMessage(HasSubstr("overflows INT32_MAX"))); + EXPECT_THROW_THAT( + [&]() { pager->WriteDictionaryPage(dictionary_over_compressed_limit); }, + ParquetException, + ::testing::Property(&ParquetException::what, + ::testing::HasSubstr("overflows INT32_MAX"))); buffer = std::make_shared(&data, 1); DataPageV1 over_uncompressed_limit( buffer, /*num_values=*/100, Encoding::BIT_PACKED, Encoding::BIT_PACKED, Encoding::BIT_PACKED, /*uncompressed_size=*/std::numeric_limits::max() + int64_t{1}); - EXPECT_THAT([&]() { pager->WriteDataPage(over_compressed_limit); }, - ThrowsMessage(HasSubstr("overflows INT32_MAX"))); + EXPECT_THROW_THAT([&]() { pager->WriteDataPage(over_compressed_limit); }, + ParquetException, + ::testing::Property(&ParquetException::what, + ::testing::HasSubstr("overflows INT32_MAX"))); } TEST(TestColumnWriter, RepeatedListsUpdateSpacedBug) {