반응형
Spring TDD를 시작해보려고 가장 간단한 hello를 호출 했는데 에러가 발생했습니다.
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(locations = "file:src/main/webapp/WEB-INF/spring/**/**.xml")
public class MemberTest {
private static final Logger logger = LoggerFactory.getLogger(MemberTest.class);
@Inject
private WebApplicationContext wac;
private MockMvc mockMvc;
@Inject
private MemberService memberService;
@Before
public void setUp() {
this.mockMvc = MockMvcBuilders.standaloneSetup(this.wac).build();
}
@Test
public void hello_테스트실행확인() throws Exception {
// String hello = memberService.hello();
// assertEquals(hello, "hello");
mockMvc.perform(get("/")).andDo(print());
// .andExpect(view().name("hello"))
// .andExpect(status().isOk());
}
}
찾아본 결과 버전을 올려주어야 합니다.
<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
에러가 발생하는 버전
<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
최소 실행 버전
반응형