.andExpect(status().isCreated())
.andExpect(jsonPath("id").exists())
.andExpect(jsonPath("id").value(Matchers.not(100)))
.andExpect(jsonPath("free").value(Matchers.not(true)))
.andExpect(header().exists(HttpHeaders.LOCATION))
.andExpect(header().string(HttpHeaders.CONTENT_TYPE, MediaTypes.HAL_JSON_VALUE))
위 조건을 만족할 경우 테스트 성공, 실패할 경우 테스트 실패하게됨.
'JUnit' 카테고리의 다른 글
(JUnit) EventController 테스트 코드 작성 (0) | 2022.03.12 |
---|