title: Java Test for Spring ExceptionalHandler
body: <p>I have a springboot project with controllers and servies. And a GlobalExceptionHandler like -</p>
  
  <pre><code>public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
   @ExceptionHandler(DataIntegrityViolationException.class)
    public ResponseEntity&lt;Object&gt; handle(DataIntegrityViolationException e, WebRequest request) {
      ....
  
       String requestPath = ((ServletWebRequest)request).getRequest().getRequestURI();
  
      // I am using this requestPath in my output from springboot
     ...
  
    }
  }
  
  </code></pre>
  
  <p>Can someone please tell me how to write mock this in my unit test class
  <code>((ServletWebRequest)request).getRequest().getRequestURI()</code></p>