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
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
Hi,

I did encounter a problem, didn’t have a time to do a sample test to reproduce it.

This is the setup:

IObjectStoreAccess* objectStoreMock = FAKE<IObjectStoreAccess>();

WHEN_CALLED(objectStoreMock->separator()).Return('/');

The tested code

auto stam1 = store->separator();

    if (repositoryPath.empty())

    {

        dp_error << "empty datapool path" << repositoryPath << endl;

    }

    else if (repositoryPath.back() == m_objectStore->separator())//store->separator())

    {

        dp_error << "path used should not include separator suffix:" << repositoryPath << endl;

    }

The problem is in the function call in the else if.  If I use a local variable then I do get the mock return.  However if the function call is in the if clause I get an exception.

What am I missing?
asked by idan (600 points)

1 Answer

0 votes
Hi Idan,

It is hard to tell.
What is the code that doesn't work?
What is the exception?
How is the fake being injected into the code?
answered by eli (5.6k points)
...