title: phpunit get exception message
body: <p>I've just started with php unit. 
  In my test cases UsersController should return:</p>
  
  <pre><code>public function UsersController() {
      ....
      throw new \Cake\Network\Exception\NotFoundException();
  }
  </code></pre>
  
  <p>phpunit code</p>
  
  <pre><code>$this-&gt;setExpectedException('Cake\Network\Exception\NotFoundException');
  </code></pre>
  
  <p>returns an assertion failed that looks like:</p>
  
  <blockquote>
    <p>App\Test\TestCase\Controller\UsersControllerTest::testActivate
    Failed asserting that exception of type "Cake\Network\Exception\NotFoundException" is thrown.</p>
  </blockquote>
  
  <p>Meanwhile browser return a 404 PageNotFound and <code>$this-&gt;assertResponseOk()</code> returns:</p>
  
  <blockquote>
    <p>App\Test\TestCase\Controller\UsersControllerTest::testActivate
    exception 'Cake\Network\Exception\NotFoundException' with message 'Not Found' in /vagrant/ifmx.local/src/Controller/UsersController.php:215</p>
  </blockquote>
  
  <p>Does somebody know why it's happened? And is there any way to get exception message in unit test.</p>