JUnit

(JUnit) .andExpect로 특정 상황에 따른 테스트를 진행

Accept 2022. 3. 12. 18:02
    	.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