Skip to content

Commit 36ffe11

Browse files
committed
test: MyBarControllerTest에 clearAllMyBar 테스트 케이스 추가
1 parent e51533b commit 36ffe11

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/test/java/com/back/domain/mybar/controller/MyBarControllerTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,4 +220,22 @@ void unkeepCocktail() throws Exception {
220220

221221
verify(myBarService).unkeep(principal.getId(), cocktailId);
222222
}
223+
224+
@Test
225+
@DisplayName("Clear entire my bar")
226+
void clearAllMyBar() throws Exception {
227+
SecurityUser principal = createPrincipal(21L);
228+
229+
willDoNothing().given(myBarService).clearAll(principal.getId());
230+
231+
mockMvc.perform(delete("/me/bar")
232+
.with(withPrincipal(principal))
233+
.accept(MediaType.APPLICATION_JSON))
234+
.andExpect(status().isOk())
235+
.andExpect(jsonPath("$.code").value(200))
236+
.andExpect(jsonPath("$.message").value("cleared"))
237+
.andExpect(jsonPath("$.data").doesNotExist());
238+
239+
verify(myBarService).clearAll(principal.getId());
240+
}
223241
}

0 commit comments

Comments
 (0)