chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes

the class in hpp is:

class ComposedClass
    int getComposedData();

class POCClassForTypeMock
    int callGetNumber();
    int getComposedData();

    ComposedClass mComposedClass;
    int getNumber();

the test is:

TEST_CASE("Testing private Search")


    POCClassForTypeMock * obj = new POCClassForTypeMock;

    PRIVATE_WHEN_CALLED(obj, getNumber).Return(0);

    REQUIRE(obj->callGetNumber() == 0);

    delete obj;


got error message:

- The function 'POCClassForTypeMock::getNumber' could not be found. If the method is not called in the code under test it will be optimized away. Remove any inline keywords, and Add ISOLATOR_TESTABLE to the method.

looks like it doesn't recognize private functions.

this example works fine in your standalone

asked by aviad (600 points)

1 Answer

0 votes

Hi Aviad,

Can you send us the sample project so we could reproduce the issue?


Alon Sapozhnikov.

Support Specialist.

answered by Alon_TypeMock (8.9k points)