-
Notifications
You must be signed in to change notification settings - Fork 450
Open
Labels
good first issueGood for newcomersGood for newcomersrefactoringRefactor code without adding featuresRefactor code without adding features
Milestone
Description
Brief feature description
Working with the ErrorHandlerMock currently requires some boiler plate code. The code and usage shall be simplified.
Detailed information
From this comment:
It is always the same procedure
- set the temporary error handler
- store the error code and an error detected flag
- check for the error detected and error code
Let's assume we have something like this
auto errorHandlerMock = iox::ErrorHandlerMock<iox::PoshError>;
// do something to trigger the error
ASSERT_TRUE(errorHandlerMock.hasError());
EXPECT_THAT(errorHandlerMock.getError(), Eq(iox::PoshError::Foo)); // assuming we keep the `NO_ERROR`, we could essentially skip the hasError call
EXPECT_THAT(errorHandlerMock.getErrorLevel(), Eq(iox::ErrorLevel::SEVERE));The ErrorHandlerMock dtor could terminate if hasError is not called, to ensure that the check is done.
elBoberido
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomersrefactoringRefactor code without adding featuresRefactor code without adding features
Type
Projects
Status
To do