Spring,MyBatis 실무 과정 자료] Spring MVC 테스팅(Test메서드)
Spring,MyBatis 실무 과정 자료] Spring MVC 테스팅(Test메서드)
실무개발자를위한 실무교육 전문교육센터학원
www.oraclejava.co.kr에 오시면 보다 다양한 강좌를 보실 수 있습니다.
Spring MVC 테스팅(Test메서드)
@Test
public void testFindUserById() throws Exception {
try {
MvcResult mvcResult = this.mockMvc
.perform(get("/rest/owners/{usrCd}.json", "admin").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$.userCd").value("admin"))
.andReturn() ;
String jsonData = mvcResult.getResponse().getContentAsString();
System.out.println(jsonData);
} catch(Exception e) {
fail();
}
}
'자바 > Spring' 카테고리의 다른 글
Spring,MyBatis 실무 과정 자료] MyBatis 3.3.0 (0) | 2017.04.24 |
---|---|
Spring,MyBatis 실무 과정 자료] 정적 리소스 이동 (0) | 2017.04.24 |
Spring,MyBatis 실무 과정 자료] Spring MVC 테스팅(WebApplicationContext설정) (0) | 2017.04.24 |
Spring,MyBatis 실무 과정 자료] Spring MVC 테스팅(Bean파일 정의) (0) | 2017.04.24 |
Spring,MyBatis 실무 과정 자료] Spring MVC 테스팅(static import) (0) | 2017.04.24 |