diff --git a/test/cryfs/config/CryConfigConsoleTest.cpp b/test/cryfs/config/CryConfigConsoleTest.cpp index 83062314..2be7e663 100644 --- a/test/cryfs/config/CryConfigConsoleTest.cpp +++ b/test/cryfs/config/CryConfigConsoleTest.cpp @@ -15,6 +15,7 @@ using std::string; using std::shared_ptr; using std::make_shared; using ::testing::_; +using ::testing::NiceMock; using ::testing::Return; using ::testing::ValuesIn; using ::testing::HasSubstr; @@ -24,11 +25,11 @@ using ::testing::WithParamInterface; class CryConfigConsoleTest: public ::testing::Test { public: CryConfigConsoleTest() - : console(make_shared()), + : console(make_shared>()), cryconsole(console), noninteractiveCryconsole(make_shared(console)) { } - shared_ptr console; + shared_ptr> console; CryConfigConsole cryconsole; CryConfigConsole noninteractiveCryconsole; }; diff --git a/test/cryfs/config/CryConfigCreatorTest.cpp b/test/cryfs/config/CryConfigCreatorTest.cpp index b4a30cfb..9adfe3d1 100644 --- a/test/cryfs/config/CryConfigCreatorTest.cpp +++ b/test/cryfs/config/CryConfigCreatorTest.cpp @@ -20,6 +20,7 @@ using ::testing::_; using ::testing::Return; using ::testing::HasSubstr; using ::testing::UnorderedElementsAreArray; +using ::testing::NiceMock; #define EXPECT_ASK_TO_USE_DEFAULT_SETTINGS() \ EXPECT_CALL(*console, askYesNo("Use default settings?", true)).Times(1) @@ -43,14 +44,14 @@ using ::testing::UnorderedElementsAreArray; class CryConfigCreatorTest: public ::testing::Test, TestWithFakeHomeDirectory { public: CryConfigCreatorTest() - : console(make_shared()), + : console(make_shared>()), tempLocalStateDir(), localStateDir(tempLocalStateDir.path()), creator(console, cpputils::Random::PseudoRandom(), localStateDir), noninteractiveCreator(make_shared(console), cpputils::Random::PseudoRandom(), localStateDir) { EXPECT_CALL(*console, ask(HasSubstr("block cipher"), _)).WillRepeatedly(ChooseAnyCipher()); EXPECT_CALL(*console, ask(HasSubstr("block size"), _)).WillRepeatedly(Return(0)); } - shared_ptr console; + shared_ptr> console; cpputils::TempDir tempLocalStateDir; LocalStateDir localStateDir; CryConfigCreator creator; diff --git a/test/cryfs/testutils/MockConsole.h b/test/cryfs/testutils/MockConsole.h index 5e4c67c5..99219640 100644 --- a/test/cryfs/testutils/MockConsole.h +++ b/test/cryfs/testutils/MockConsole.h @@ -23,7 +23,7 @@ class TestWithMockConsole { public: // Return a console that chooses a valid cryfs setting static std::shared_ptr mockConsole() { - auto console = std::make_shared(); + auto console = std::make_shared<::testing::NiceMock>(); EXPECT_CALL(*console, ask(::testing::_, ::testing::_)).WillRepeatedly(ChooseCipher("aes-256-gcm")); EXPECT_CALL(*console, askYesNo(::testing::_, ::testing::_)).WillRepeatedly(::testing::Return(true)); return console;