|
27 | 27 |
|
28 | 28 | import static org.assertj.core.api.Assertions.assertThat; |
29 | 29 | import static org.hamcrest.Matchers.notNullValue; |
| 30 | +import static org.hamcrest.Matchers.nullValue; |
30 | 31 | import static org.junit.jupiter.api.Assertions.assertEquals; |
31 | 32 | import static org.junit.jupiter.api.Assertions.assertNotNull; |
32 | 33 | import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; |
@@ -404,6 +405,52 @@ void equipTitle() throws Exception { |
404 | 405 | .andExpect(jsonPath("$.content.title").value(title2.getId())); |
405 | 406 | } |
406 | 407 |
|
| 408 | + @Test |
| 409 | + @DisplayName("아이템 장착 해제") |
| 410 | + void unequipItem() throws Exception { |
| 411 | + ResultActions resultActions = mvc |
| 412 | + .perform( |
| 413 | + put(baseUrl + "/unequip/item") |
| 414 | + .contentType(MediaType.APPLICATION_JSON) |
| 415 | + .content(""" |
| 416 | + { |
| 417 | + "type": "%s" |
| 418 | + } |
| 419 | + """.formatted(item1.getType()).stripIndent()) |
| 420 | + .cookie(new Cookie("apiKey", user1.getApiKey())) |
| 421 | + ) |
| 422 | + .andDo(print()); |
| 423 | + |
| 424 | + resultActions |
| 425 | + .andExpect(handler().handlerType(ApiV1MemberController.class)) |
| 426 | + .andExpect(handler().methodName("unequipItem")) |
| 427 | + .andExpect(status().isOk()) |
| 428 | + .andExpect(jsonPath("$.code").value("200")) |
| 429 | + .andExpect(jsonPath("$.message").value("[Member] Success: 아이템 장착 해제 (%s)".formatted(item1.getType()))) |
| 430 | + .andExpect(jsonPath("$.content").exists()) |
| 431 | + .andExpect(jsonPath("$.content.items." + item1.getType()).value(nullValue())); |
| 432 | + } |
| 433 | + |
| 434 | + @Test |
| 435 | + @DisplayName("칭호 장착 해제") |
| 436 | + void unequipTitle() throws Exception { |
| 437 | + ResultActions resultActions = mvc |
| 438 | + .perform( |
| 439 | + put(baseUrl + "/unequip/title") |
| 440 | + .cookie(new Cookie("apiKey", user1.getApiKey())) |
| 441 | + ) |
| 442 | + .andDo(print()); |
| 443 | + |
| 444 | + resultActions |
| 445 | + .andExpect(handler().handlerType(ApiV1MemberController.class)) |
| 446 | + .andExpect(handler().methodName("unequipTitle")) |
| 447 | + .andExpect(status().isOk()) |
| 448 | + .andExpect(jsonPath("$.code").value("200")) |
| 449 | + .andExpect(jsonPath("$.message").value("[Member] Success: 칭호 장착 해제")) |
| 450 | + .andExpect(jsonPath("$.content").exists()) |
| 451 | + .andExpect(jsonPath("$.content.title").value(nullValue())); |
| 452 | + } |
| 453 | + |
407 | 454 | @Test |
408 | 455 | @DisplayName("회원 탈퇴") |
409 | 456 | void del() throws Exception { |
|
0 commit comments