samedi 28 février 2015

i want to write gmock google test cases for the below scenario

i have set of functions within the Singleton class. i want to mock a function in the singleton class. Lets take the below piece of code.The function setname() will return the string from the classyyy's setname() funciton. so here i want to test the return value.so please tell me how to write the test case for this situation.



class mockBtMxxx : public BTMxxx
{
public:
MOCK_METHOD2(setname, string(const int& id, const string& name));
};

// Test case for Setting Local Device Friendly Name.
TEST(TestBTC, GMockSetNameTest)
{
mockBtMxxx mock_Btm;
int id = 12345;
string str = "Hello";
EXPECT_CALL(mock_Btm, setname(_,_)).WillOnce(Return("Hello"));
}


I am getting the below errors : error: ‘BTMxxx::BTMxxx()’ is private gmock-actions.h:491:66: error: no matching function for call to ‘ImplicitCast_(const char*&)’


Aucun commentaire:

Enregistrer un commentaire