title: Play 2.5.x junit test error handling with fakeRequest
body: <p>My program uses global error handling. When i using fakeRequest() to test, it throws out exception instead of trigger my error handler.
  Am I missing some configuration? Or how can I test my global error handler.</p>
  
  <p>Below is my current code:</p>
  
  <p>Controller:</p>
  
  <pre><code>public class MyController {
      public Result MyService() {
          if (true) throw new RuntimeException("exception");
      }
  }
  </code></pre>
  
  <p>ErrorHandler:</p>
  
  <pre><code>@Singleton
  public class MyErrorHandler extends DefaultHttpErrorHandler {
  
    @Inject
    public MyErrorHandler (Configuration configuration, Environment environment, OptionalSourceMapper sourceMapper, Provider&lt;Router&gt; routes) {
      super(configuration, environment, sourceMapper, routes);
    }
  
    @Override
    public CompletionStage&lt;Result&gt; onServerError(Http.RequestHeader request, Throwable exception) {
      return CompletableFuture.completedFuture(ok(exception.getMessage()));
    }
  }
  </code></pre>
  
  <p>Test:</p>
  
  <pre><code>public class MyTest {
    @Test
    public void testMethod() {
      Result result = route(fakeRequest("GET", "/MyService"));
      assertEquals(OK, result.status());
    }
  }
  </code></pre>
  
  <p>Note: When I run application, the error handling is working as expected.</p>