title: Async RestController endpoints :: Async result for handler was not set during the specified timeToWait=0
body: <p>We have endpoints of the form:</p>
  
  <pre class="lang-java prettyprint-override"><code>@GetMapping("/myurl")
  public Callable&lt;String&gt; getARandomString(@RequestParam int a) {
  </code></pre>
  
  <p>The application is configured with just one thread (that's why we use <code>Callable</code>s to handle this). However, in order to create the tests for this, we do the setup as follows:</p>
  
  <pre class="lang-java prettyprint-override"><code>@RunWith(SpringRunner.class)
  @SpringBootTest(classes = {MyApplication.class, MyController.class})
  @ActiveProfiles("test")
  public class MyControllerTest {
  
      @MockBean
      private MyService myService;
  
      @Autowired
      private WebApplicationContext wac;
  
      private MockMvc mockMvc;
  
      @Before
      public void before() {
          MockitoAnnotations.initMocks(this);
          mockMvc = MockMvcBuilders.webAppContextSetup(wac)
                  .build();
  
          when(myServices.isOk()).thenReturn(true);
      }
  
      @Test
      public void given_when_then() throws Exception {
  
          MvcResult mvcResult = mockMvc.perform(get("/myurl")
                  .param("a", 1))
                  .andExpect(request().asyncStarted())
                  .andReturn();
  
          mvcResult.getAsyncResult();
  
          mockMvc
                  .perform(asyncDispatch(mvcResult))
                  .andExpect(status().isOk());
      }
  </code></pre>
  
  <p>1 test at the time works perfect. On the contrary, when having more <strong>than 1 test</strong> an exception as the following is thrown:</p>
  
  <pre><code>java.lang.IllegalStateException: Async result for handler [public java.util.concurrent.Callable&lt;String&gt; com.antmordel.MyController. getARandomString(int)] was not set during the specified timeToWait=0
  </code></pre>
  
  <p>I reckon that it is something about the timeouts. Have anybody had this issue?</p>