Skip to content

Commit

Permalink
f-lab-edu#30 상품 테스트 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
kimsuyeondev committed May 19, 2024
1 parent e53e6f2 commit 17b7c73
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import java.util.ArrayList;
import java.util.List;

import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.Matchers.is;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
Expand Down Expand Up @@ -58,9 +60,9 @@ public void validGoodsTest() throws Exception {
//then
resultActions.andExpect(jsonPath("errorCode").value("INVALID_PARAMETER"));
resultActions.andExpect(jsonPath("errorMessage").value("유효하지 않는 값입니다"));
resultActions.andExpect(jsonPath("$.fieldErrorList[0].field").value("goodsNm"));
resultActions.andExpect(jsonPath("$.fieldErrorList[0].field").value(anyOf(is("items[0].itemNm"), is("goodsNm"))));
resultActions.andExpect(jsonPath("$.fieldErrorList[0].message").value("must not be blank"));
resultActions.andExpect(jsonPath("$.fieldErrorList[1].field").value("items[0].itemNm"));
resultActions.andExpect(jsonPath("$.fieldErrorList[1].field").value(anyOf(is("items[0].itemNm"), is("goodsNm"))));
resultActions.andExpect(jsonPath("$.fieldErrorList[1].message").value("must not be blank"));
}

Expand Down

0 comments on commit 17b7c73

Please sign in to comment.