@@ -0,0 +1,2658 @@
+package com.wepiao.springmvc.asynch.teststub;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.MockitoAnnotations;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.boot.test.SpringApplicationConfiguration;%0Aimport org.springframework.test.context.junit4.SpringJUnit4ClassRunner;%0Aimport org.springframework.test.context.web.WebAppConfiguration;%0Aimport org.springframework.test.web.servlet.MockMvc;%0Aimport org.springframework.test.web.servlet.MvcResult;%0Aimport org.springframework.test.web.servlet.setup.MockMvcBuilders;%0Aimport org.springframework.web.context.WebApplicationContext;%0A%0Aimport static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.asyncDispatch;%0Aimport static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;%0Aimport static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;%0Aimport static org.springframework.test.web.servlet.result.MockMvcResultMatchers.request;%0Aimport static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;%0A%0A%0A@RunWith(SpringJUnit4ClassRunner.class)%0A@SpringApplicationConfiguration(classes = Application.class)%0A@WebAppConfiguration%0Apublic class ProcessingControllerTest %7B%0A%0A    private MockMvc mockMvc;%0A    %0A    @Autowired%0A    WebApplicationContext wac;%0A    %0A    private final String expectedResult = %22%7B%5C%22status%5C%22:%5C%22Ok%5C%22,%5C%22processingTimeMs%5C%22:2000%7D%22;%0A    %0A    @Before%0A    public void setup()%7B%0A        %0A        // Process mock annotations%0A        MockitoAnnotations.initMocks(this);%0A        %0A        // Setup Spring test in webapp-mode (same config as spring-boot)%0A        this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build();%0A        %0A    %7D%0A    %0A    @Test%0A    public void testProcessBlocking() throws Exception%7B%0A        this.mockMvc.perform(get(%22/process-blocking?minMs=2000&maxMs=2000%22))%0A                .andExpect(status().isOk())%0A                .andExpect(content().contentType(%22application/json;charset=UTF-8%22))%0A                .andExpect(content().string(expectedResult));%0A    %7D%0A%0A    @Test%0A    public void testProcessNonBlocking() throws Exception %7B%0A%0A        MvcResult mvcResult = this.mockMvc.perform(get(%22/process-non-blocking?minMs=2000&maxMs=2000%22))%0A                .andExpect(request().asyncStarted())%0A                .andReturn();%0A%0A        mvcResult.getAsyncResult();%0A%0A        this.mockMvc.perform(asyncDispatch(mvcResult))%0A                .andExpect(status().isOk())%0A                .andExpect(content().contentType(%22application/json;charset=UTF-8%22))%0A                .andExpect(content().string(expectedResult));%0A    %7D%0A%7D%0A

add test case