diff options
Diffstat (limited to 'tests/unit/unittest/stringcache-test.cpp')
-rw-r--r-- | tests/unit/unittest/stringcache-test.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/unit/unittest/stringcache-test.cpp b/tests/unit/unittest/stringcache-test.cpp index 8eecd92c44..5a2b1d404d 100644 --- a/tests/unit/unittest/stringcache-test.cpp +++ b/tests/unit/unittest/stringcache-test.cpp @@ -65,6 +65,12 @@ class StringCache : public testing::Test protected: void SetUp() { + mockStorageFetchDirectyId = [&](Utils::SmallStringView string) { + return mockStorage.fetchDirectoryId(string); + }; + mockStorageFetchDirectyPath = [&](int id) { + return mockStorage.fetchDirectoryPath(id); + }; std::sort(filePaths.begin(), filePaths.end(), [](auto &f, auto &l) { return compare(f, l) < 0; }); @@ -82,12 +88,8 @@ protected: protected: NiceMock<MockSqliteDatabase> mockDatabase; NiceMock<MockFilePathStorage> mockStorage{mockDatabase}; - StorageIdFunction mockStorageFetchDirectyId = [&](Utils::SmallStringView string) { - return mockStorage.fetchDirectoryId(string); - }; - StorageStringFunction mockStorageFetchDirectyPath = [&](int id) { - return mockStorage.fetchDirectoryPath(id); - }; + StorageIdFunction mockStorageFetchDirectyId; + StorageStringFunction mockStorageFetchDirectyPath; Cache cache; typename Cache::MutexType &mockMutex = cache.mutex(); Utils::PathString filePath1{"/file/pathOne"}; |