title: pass remoteUser value in HttpServletRequest to mockmvc perform test
body: <p>I have an api call as:</p>
  
  <pre><code>@RequestMapping(value = "/course", method = RequestMethod.GET)
  ResponseEntity&lt;Object&gt; getCourse(HttpServletRequest request, HttpServletResponse response) throwsException {
          User user = userDao.getByUsername(request.getRemoteUser());
  
  }
  </code></pre>
  
  <p>I'm getting the user null when I call this from the test class like:   </p>
  
  <pre><code>HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
   Mockito.when(request.getRemoteUser()).thenReturn("test1");
  
      MvcResult result =  mockMvc.perform( get( "/course")
                      .contentType(MediaType.APPLICATION_JSON)
                      .andExpect( status().isOk() )
                      .andExpect( content().contentType( "application/json;charset=UTF-8" ) )
                      .andReturn();
  </code></pre>
  
  <p>When I debug request object I can see <code>remoteUser=null</code>. So how can I pass the value to remote user?</p>