i’m trying to get an EXPECT_CALL from a detached thread.
The code where the function is called is like this:
for (auto &eventHandler : this->diagnosticEventHandlers)
{
std::thread(&IDiagnosticFunctionFeatureEventHandler::onDiagnosticEventRaised,
eventHandler,
responseMessage.getDiagnosticEventState()).detach();
}
The EXPECT_CALL like this:
EXPECT_CALL(mockEventHandler, onDiagnosticEventRaised(DiagnosticEventStates::Undefined)).Times(1);
But the the EXPECT_CALL is never happening because the method is called in a detached thread.
Is there an easy way to get an EXPECT_CALL from a detached thread?
This the message in my test: Expected: to be called once [ctest] Actual: never called - unsatisfied and active