title: Can't test HTTP status on MockMvc async REST service in spring-test 5.0.3 (works in 5.0.0)
body: <p>I've generated fresh project using Spring Initializer (<a href="https://start.spring.io/" rel="nofollow noreferrer">https://start.spring.io/</a>)
  Spring boot - 2.0.0.RC1 which ships spring in version 5.0.3.RELEASE.</p>
  
  <p>Added the following controller:</p>
  
  <pre><code>@RestController
  @ResponseBody
  @RequestMapping(value = "/customer")
  public class CustomerController {
      @GetMapping("/")
      public Future&lt;ResponseEntity&lt;String&gt;&gt; get1() {
          return CompletableFuture.supplyAsync(() -&gt; new ResponseEntity&lt;String ("not found", HttpStatus.NOT_FOUND));
      }
  }
  </code></pre>
  
  <p>and having the following dependencies section in build.gradle (problem can be also replicated on maven build)</p>
  
  <pre><code>dependencies {
      compile('org.springframework.boot:spring-boot-starter')
      compile('org.springframework.boot:spring-boot-starter-web')
      compile('org.springframework:spring-web')
      testCompile('org.springframework:spring-test')
      testCompile('org.springframework.boot:spring-boot-starter-test')
  }
  </code></pre>
  
  <p>The following test fails:</p>
  
  <pre><code>@SpringBootTest
  @RunWith(SpringRunner.class)
  @AutoConfigureMockMvc
  public class CustomerControllerTest {
      @Autowired
      private MockMvc mockMvc;
  
      @Test
      public void test404() throws Exception {
          MvcResult asyncResult = mockMvc.perform(MockMvcRequestBuilders.get("/customer/"))
                  .andExpect(request().asyncStarted())
                  .andReturn();
  
          mockMvc.perform(asyncDispatch(asyncResult))
                  .andExpect(status().isNotFound());
      }
  }
  </code></pre>
  
  <p>with the following log:</p>
  
  <pre><code>MockHttpServletRequest:
        HTTP Method = GET
        Request URI = /customer/
         Parameters = {}
            Headers = {}
               Body = null
      Session Attrs = {}
  
  Handler:
               Type = com.example.wkicior.demo.CustomerController
             Method = public java.util.concurrent.Future&lt;org.springframework.http.ResponseEntity&lt;java.lang.String&gt;&gt; com.example.wkicior.demo.CustomerController.get1()
  
  Async:
      Async started = true
       Async result = &lt;404 Not Found,not found,{}&gt;
  
  Resolved Exception:
               Type = null
  
  ModelAndView:
          View name = null
               View = null
              Model = null
  
  FlashMap:
         Attributes = null
  
  MockHttpServletResponse:
             Status = 200
      Error message = null
            Headers = {}
       Content type = null
               Body = 
      Forwarded URL = null
     Redirected URL = null
            Cookies = []
  
  MockHttpServletRequest:
        HTTP Method = GET
        Request URI = /customer/
         Parameters = {}
            Headers = {}
               Body = null
      Session Attrs = {}
  
  Handler:
               Type = com.example.wkicior.demo.CustomerController
             Method = public java.util.concurrent.Future&lt;org.springframework.http.ResponseEntity&lt;java.lang.String&gt;&gt; com.example.wkicior.demo.CustomerController.get1()
  
  Async:
      Async started = false
       Async result = null
  
  Resolved Exception:
               Type = null
  
  ModelAndView:
          View name = null
               View = null
              Model = null
  
  FlashMap:
         Attributes = null
  
  MockHttpServletResponse:
             Status = 200
      Error message = null
            Headers = {Content-Type=[text/plain;charset=UTF-8], Content-Length=[9]}
       Content type = text/plain;charset=UTF-8
               Body = not found
      Forwarded URL = null
     Redirected URL = null
            Cookies = []
  
  java.lang.AssertionError: Status 
  Expected :404
  Actual   :200
  </code></pre>
  
  <p>It seems that the test sees status code as 200, not 404. The body content is returned properly, though.
  What's interesting that downgrading to 5.0.0.RELEASE of spring-test - fixes the problem:</p>
  
  <pre><code>testCompile('org.springframework:spring-test:5.0.0.RELEASE')
  </code></pre>
  
  <p>Is this a spring-test bug?</p>