There seems to be a lot of question regarding "when to mock". But I did not get an answer on my question so far. It can be, I do not know a specific search request that would point me to the answer.
Imagine we have a class (MyClass). Imagine that this class has methods that can return both std::string and a wrapper class (MyStringWrapper defined in another library) object. MyStringWrapper is not exactly aggregator (we can consider to use struct here, but let's prefer a class for this particular example), since its setter has one if and several copy operations. Now, there is a 3rd class (UserClass) that uses MyClass and MyStringWrapper class.
As a good SW developer, I would like to unit-test my UserClass (as many refer "to smell a code"). For unit-testing I would use gtests and gmock to create a mock of the MyClass (let's call it MyClassMock). However, I remember that somewhere it was told "you have to mock everything, which is defined in another library/3rd party library". Both std::string and MyStringWrapper are defined in 3rd party libraries.
Now the question. So, should I in this case create mocks for both std::string and MyStringWrapper?
You can imagine the usage of the returned std::string/MyStringWrapper object as
if(myreturnedstdstring.empty()) return 1; if(mywrapperobject.failed()) return 100;
I was asked in comments here Is there a point to unit tests that stub and mock everything public?
create another topic.