spring mvc showcase
https://github.com/spring-projects/spring-mvc-showcase
Spring Security Reference
javax.servlet-api 라이브러리 버전 변경
<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
class HomControllerTest
package com.java.web;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.forwardedUrl;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.standaloneSetup;
import org.junit.Test;
public class HomControllerTest {
@Test
public void home() throws Exception{
standaloneSetup(new HomeController()).build()
.perform(get("/"))
.andExpect(status().isOk())
.andExpect(forwardedUrl("home"));
}
}
INFO : org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 5.4.0.Final
INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter - Looking for @ControllerAdvice: org.springframework.test.web.servlet.setup.StubWebApplicationContext@66d33a
INFO : org.springframework.mock.web.MockServletContext - Initializing Spring FrameworkServlet ''
INFO : org.springframework.test.web.servlet.TestDispatcherServlet - FrameworkServlet '': initialization started
INFO : org.springframework.test.web.servlet.TestDispatcherServlet - FrameworkServlet '': initialization completed in 4 ms
INFO : com.java.web.HomeController - Welcome home! The client locale is en.
댓글 ( 4)
댓글 남기기