title: Spring mvc Test Webapplication vs StandAlone
body: <p>I'm doing a junit test for my spring mvc web application.
      I'm using mockito to simulate the request and response,the problem is when i Auto-wired the webApplicationContext and i set a breakpoint on the method , the execution stopped as it supposed to do
        and everything works fine but when i use a standaloneSetup with an instance of the class ,the execution doesn't stop at breakpoint (on the controller method) even if i got an ok status and always with an empty response,
      is it normal?
  Thanks.</p>
  
  <p>this is the code, it's simple:</p>
  
  <pre><code>  public class EmployeeTest{
   private MockMvc mockMvc; 
   @Mock EmployeeController employerctrl;
   @Before public void setUp() { MockitoAnnotations.initMocks(this);
   mockMvc = MockMvcBuilders.standaloneSetup(employerctrl).build();} 
   @Test
             public void LoginTest() throws Exception {
               this.mockMvc.perform(MockMvcRequestBuilders.get("/login"))  
               .andDo(print())
                  .andExpect(MockMvcResultMatchers.status().isOk())  
                  .andExpect(MockMvcResultMatchers.view().name("login-page"));
  
              }
   }
  </code></pre>
  
  <p>and this is the class :</p>
  
  <pre><code> @Transactional(readOnly = true)
   @Controller
   public class EmployeeController {
   @RequestMapping(value="/login")
   public String login() {
      return "login-page";
      }
   }
  </code></pre>
  
  <p>i have always an OK status but , without stopping in breakpoint and an empty body response.</p>