title: Getting NullpointerException in Mockito
body: <p>I have actual method below:</p>
  
  <pre><code>public ResponseEntity&lt;Message&gt; catEnter(@PathVariable("catId") BigInteger catId, @RequestBody Catrequest catReq, HttpServletRequest request) throws CatDataException, InvalidCatExcecatption {
      Message message = new Message();
      try {
          message = catManager.submitData(catReq.getMessage(), catId, request);
      } catch (IOException e) {
          throw new CatDataAppException(e.getMessage());
      }
      return (ResponseEntity&lt;Message&gt;) restResponse(message, request.getMethod());
      // Getting null pointer exception in above line
  }
  </code></pre>
  
  <p>I am using mockito for my test code as below:</p>
  
  <pre><code>@Test
  public void submitData() throws Exception {
      Message mes = new Message();
      mes.setCode("00");
      mes.setMessage("hi");
      ResponseEntity&lt;Message&gt; responseentity = ((ResponseEntity&lt;Message&gt;) catController.catEnter(BigInteger.valueOf(3431), catRequest, mockRequest));
  }
  </code></pre>
  
  <p>I'm getting null pointer exception, Message going as a null, even I set the value explicitly?</p>