I'm getting an exception when trying to write a unit test for a simple LoginController method that returns a Thymeleaf view.
Sounds like I need to specify a ViewResolver but not sure how to do that.
LoginController
@Controller
public class LoginController {
    @RequestMapping(value = {"/", "/login"}, method = RequestMethod.GET)
    public ModelAndView login() {
      return new ModelAndView("login");
    }
}
LoginControllerTest
@RunWith(SpringRunner.class)
public class LoginControllerTest {
  private MockMvc mockMvc;
  @Before
  public void setUp() {
    mockMvc = MockMvcBuilders.standaloneSetup(new LoginController())
                             .build();
  }
  @Test
  public void testLoginPage() throws Exception {
    this.mockMvc.perform(get("/login"))
                .andExpect(status().isOk())
                .andExpect(view().name("login"))
                .andDo(print());
  }
}
Error
javax.servlet.ServletException: Circular view path [/login]: would dispatch back to the current handler URL [/login] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
