I got the issue MockInterfaceTest.MockTest unknown file: error: C++ exception with description " The mock function has no default action set, and its return type has no default value set." thrown in the test body. Can anyone explain why this comes? I googled it but didn't find anything.
#include "pch.h"
#include "gtest/gtest.h"
#include "gmock/gmock.h"
#include "../../StaticLib1/StaticLib1/SysProps.h"
class MockTest : public PropertyInterface
{
public:
MOCK_METHOD0(getComputerName, TCHAR*());
MOCK_METHOD0(getSysDirectory, TCHAR*());
MOCK_METHOD0(getUserName, TCHAR*());
MOCK_METHOD0(getWindowsDir, TCHAR*());
MOCK_METHOD0(getHardwareValue, SYSTEM_INFO());
};
using ::testing::_;
TEST(MockInterfaceTest, MockTest)
{
MockTest mt;
EXPECT_CALL(mt, getComputerName()).Times(1);
EXPECT_CALL(mt, getSysDirectory()).Times(1);
EXPECT_CALL(mt, getUserName()).Times(1);
EXPECT_CALL(mt, getWindowsDir()).Times(1);
EXPECT_CALL(mt, getHardwareValue()).Times(1);
mt.getComputerName();
mt.getSysDirectory();
mt.getUserName();
mt.getWindowsDir();
mt.getHardwareValue();
}
int main(int argc, char** argv) {
::testing::InitGoogleMock(&argc, argv);
return RUN_ALL_TESTS();
}