// Path: mvc/src/main/java/me/chanjar/web/Foo.java
// public interface Foo {
// 
//   boolean checkCodeDuplicate(String code);
// 
// }
// 
// Path: mvc/src/main/java/me/chanjar/web/FooController.java
// @Controller
// public class FooController {
// 
//   @Autowired
//   private Foo foo;
// 
//   @RequestMapping(path = "/foo/check-code-dup", method = RequestMethod.GET)
//   public ResponseEntity<Boolean> checkCodeDuplicate(@RequestParam String code) {
// 
//     return new ResponseEntity<>(
//         Boolean.valueOf(foo.checkCodeDuplicate(code)),
//         HttpStatus.OK
//     );
// 
//   }
// 
// }


import me.chanjar.web.Foo;
import me.chanjar.web.FooController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup;
package me.chanjar.spring2;



@EnableWebMvc
@WebAppConfiguration
@ContextConfiguration(classes = { FooController.class })
@TestExecutionListeners(listeners = MockitoTestExecutionListener.class)
public class SpringMvc_2_Test extends AbstractTestNGSpringContextTests {

  @Autowired
  private WebApplicationContext wac;

  @MockBean
  private Foo foo;

  private MockMvc mvc;

// Path: mvc/src/main/java/me/chanjar/web/Foo.java
// public interface Foo {
// 
//   boolean checkCodeDuplicate(String code);
// 
// }
// 
// Path: mvc/src/main/java/me/chanjar/web/FooController.java
// @Controller
// public class FooController {
// 
//   @Autowired
//   private Foo foo;
// 
//   @RequestMapping(path = "/foo/check-code-dup", method = RequestMethod.GET)
//   public ResponseEntity<Boolean> checkCodeDuplicate(@RequestParam String code) {
// 
//     return new ResponseEntity<>(
//         Boolean.valueOf(foo.checkCodeDuplicate(code)),
//         HttpStatus.OK
//     );
// 
//   }
// 
// }


// Path: mvc/src/test/java/me/chanjar/spring2/SpringMvc_2_Test.java
import me.chanjar.web.Foo;
import me.chanjar.web.FooController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup;

package me.chanjar.spring2;



@EnableWebMvc
@WebAppConfiguration
@ContextConfiguration(classes = { FooController.class })
@TestExecutionListeners(listeners = MockitoTestExecutionListener.class)
public class SpringMvc_2_Test extends AbstractTestNGSpringContextTests {

  @Autowired
  private WebApplicationContext wac;

  @MockBean
  private Foo foo;

  private MockMvc mvc;

  @BeforeMethod