title: Mockito: check response Header and Status
body: <p>I have this junit test using Mockito (an open source testing framework for Java released under the MIT License) in a The Spring Web model-view-controller (MVC) framework application
  I have this methods in the controller:</p>
  
  <pre><code>@RequestMapping(value = { "/devices" } , method = { RequestMethod.GET, RequestMethod.POST} )
      public void initGetForm(@ModelAttribute("searchForm") final SearchForm searchForm,
                              HttpServletRequest request,
                              HttpServletResponse response,
                              Locale locale) throws Exception {
  
          String newUrl = request.getContextPath() + "/devices/" + locale;
  
          if (locale !=null &amp;&amp; isValid(locale)) {
              newUrl = request.getContextPath() + "/devices/" + DEFAULT_LOCALE;           
          } 
  
          redirectPermanently (response, newUrl);     
  
      }
  
  
  
  
      protected void redirectPermanently (HttpServletResponse response, String to) {
  
          response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
          response.setHeader("Location", to);
          response.setHeader("Connection", "close");
          }
  </code></pre>
  
  <p>and this is my Test class:</p>
  
  <pre><code>@Test
      public void testInitGetForm() throws Exception {
  
          controller.initGetForm(emptySearchForm(), request, response, null);
  
      }
  
  @Before
  public void setUpTest() {
      request = new MockHttpServletRequest();
      response = new MockHttpServletResponse();
  }
  </code></pre>
  
  <p>Is it possible to check the Header and Status of the response ?????</p>