title: PHPUnit not asserting Exceptions
body: <p>I am using phpunit 4.8.23 with laravel 5.2.</p>
  
  <p>One of my controller is throwing an HttpException as below.</p>
  
  <pre><code>throw new HttpException(403, 'auth_failure');
  </code></pre>
  
  <p>and in Handler.php</p>
  
  <pre><code>if ($e instanceof HttpException){
      return response()-&gt;json(array(...), $e-&gt;getStatusCode());
  }
  </code></pre>
  
  <p>For testing this, I used the following codes in my test file.</p>
  
  <p>1</p>
  
  <pre><code>/**
   * @expectedException Symfony\Component\HttpKernel\Exception\HttpException
   * @expectedExceptionMessage auth_failure
   */
    public function testMethod(){....}
  </code></pre>
  
  <p>2 </p>
  
  <pre><code>public function testMethod(){
  $this-&gt;json(.....);
  $this-&gt;setExpectedException('HttpException');
  }
  </code></pre>
  
  <p>3 and even try catch</p>
  
  <pre><code>try {$this-&gt;json(....)}
  catch(\Symfony\Component\HttpKernel\Exception\HttpException $e){..}
  </code></pre>
  
  <p>I tried the 3rd case with <code>\Exception</code> also.</p>
  
  <p>In all cases, I get output as </p>
  
  <pre><code>PHPUnit 4.8.23 by Sebastian Bergmann and contributors.
  
  .Symfony\Component\HttpKernel\Exception\HttpException {#986
  -statusCode: 403
  -headers: []
  #message: "auth_failure"
  #code: 0
  #file: "&lt;path to file&gt;"
  #line: 103
  -trace: {
  57. App\Http\Controllers\DeviceController-&gt;register() ==&gt; new    Symfony\Component\HttpKernel\Exception\HttpException(): {.....
  </code></pre>
  
  <p>I have gone throgh <a href="https://stackoverflow.com/questions/4159002/phpunit-doesnt-catch-expected-exceptions">this</a>, <a href="https://stackoverflow.com/questions/23207807/phpunit-testing-exceptions-for-laravel-resource-controllers">this</a> and <a href="https://stackoverflow.com/questions/21555299/handling-laravel-httpexception-in-unit-testing">this</a> questions but could not make any progress.</p>
  
  <p><strong>EDIT</strong>
  I hope I have provided all the relevant informations. Here is the full method anyway</p>
  
  <pre><code>/**
   * @expectedException Symfony\Component\HttpKernel\Exception\HttpException
   * @expectedExceptionMessage auth_failure
   */
  public function testRegAuthFailure()
  {
  
      $this-&gt;json('POST',
                  'auth',
                  [
                      "lang" =&gt; "us_en",
                      "data" =&gt; [
                          "identity"      =&gt; "00000004",
                          "password"      =&gt; "wrong",              
                      ]
                  ]
      );
  
      $this-&gt;setExpectedException('HttpException');
  }
  </code></pre>
  
  <p>any help is appreciated :) </p>