7171namespace paimon ::test {
7272class GmockFileSystem : public LocalFileSystem {
7373 public:
74- GmockFileSystem () {
75- ON_CALL (*this , ListDir (testing::_, testing::_))
76- .WillByDefault (testing::Invoke (
77- [&](const std::string& directory,
78- std::vector<std::unique_ptr<BasicFileStatus>>* file_status_list) {
79- return this ->LocalFileSystem ::ListDir (directory, file_status_list);
80- }));
81- ON_CALL (*this , ReadFile (testing::_, testing::_))
82- .WillByDefault (testing::Invoke ([&](const std::string& path, std::string* content) {
83- return this ->FileSystem ::ReadFile (path, content);
84- }));
85- ON_CALL (*this , AtomicStore (::testing::_, ::testing::_))
86- .WillByDefault (
87- testing::Invoke ([&](const std::string& path, const std::string& content) {
88- return this ->FileSystem ::AtomicStore (path, content);
89- }));
90- }
91-
9274 MOCK_METHOD (Status, ReadFile, (const std::string& path, std::string* content), (override ));
9375 MOCK_METHOD (Status, ListDir,
9476 (const std::string& directory,
@@ -113,6 +95,22 @@ class GmockFileSystemFactory : public LocalFileSystemFactory {
11395class FileStoreCommitImplTest : public testing ::Test {
11496 public:
11597 void SetUp () override {
98+ ON_CALL (*this , ListDir (testing::_, testing::_))
99+ .WillByDefault (testing::Invoke (
100+ [&](const std::string& directory,
101+ std::vector<std::unique_ptr<BasicFileStatus>>* file_status_list) {
102+ return this ->LocalFileSystem ::ListDir (directory, file_status_list);
103+ }));
104+ ON_CALL (*this , ReadFile (testing::_, testing::_))
105+ .WillByDefault (testing::Invoke ([&](const std::string& path, std::string* content) {
106+ return this ->FileSystem ::ReadFile (path, content);
107+ }));
108+ ON_CALL (*this , AtomicStore (::testing::_, ::testing::_))
109+ .WillByDefault (
110+ testing::Invoke ([&](const std::string& path, const std::string& content) {
111+ return this ->FileSystem ::AtomicStore (path, content);
112+ }));
113+
116114 auto factory_creator = paimon::FactoryCreator::GetInstance ();
117115 factory_creator->Register (" gmock_fs" , (new GmockFileSystemFactory));
118116 dir_ = UniqueTestDirectory::Create ();
0 commit comments