title: Test an aborting assertion failure in CppUnit
body: <p>I want to unit test a C++ function which throws aborting assertion error on invalid input. </p>
  
  <p>The function is as follows:</p>
  
  <pre><code>uint64_t FooBar::ReadTimeStamp(std::string&amp; name) {
    auto iter = hash_table_.find(name);
    assert(iter != hash_table_.end());
    ....
  }
  </code></pre>
  
  <p>In unit test, I use <code>CPPUNIT_ASSERT_ASSERTION_FAIL</code> to assert on assertion failure:</p>
  
  <pre><code>void FooBarTest::
    TestReadNonexistentTimestamp() {
    CPPUNIT_ASSERT_ASSERTION_FAIL(ReadTimestamp("NON_EXISTENT"));
  }
  </code></pre>
  
  <p>But I got abort message and unit test failed.</p>
  
  <p>I read <a href="http://cppunit.sourceforge.net/doc/cvs/group___assertions.html" rel="nofollow noreferrer">this page</a>. It's not clear to me if I need to throw exception here and what the correct way to unit test this scenario would be. Thanks!</p>