I want to test that MyException is thrown in a certain case. EXPECT_THROW is good here. But I also want to check the exception has a specific state
MyException
EXPECT_THROW
You can try Boost lightweight test:
#include #include void function_that_would_throw(int x) { if (x > 0) { throw std::runtime_error("throw!"); } } int main() { BOOST_TEST_THROWS(function_that_would_throw(10), std::runtime_error); boost::report_errors(); }