Skip to content

Commit

Permalink
[Test] 테스트 코드 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
AreSain committed Sep 9, 2024
1 parent 6b052f2 commit 5e46603
Showing 1 changed file with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ void beforeEach() {
}

@Test
@DisplayName("200 티켓 개수 확인 성공")
void findTicketCountSuccess() throws Exception {
@DisplayName("200 티켓 개수 확인 성공 및 setupTicket 확인")
void findTicketCountSetupTrueSuccess() throws Exception {
//given
ticketFixture.createTicket(seoulUserAgendaProfile);
ticketFixture.createTicket(seoulUserAgendaProfile);
Expand All @@ -158,6 +158,27 @@ void findTicketCountSuccess() throws Exception {
TicketCountResDto result = objectMapper.readValue(res, TicketCountResDto.class);
//then
assertThat(result.getTicketCount()).isEqualTo(2);
assertThat(result.isSetupTicket()).isTrue();
}

@Test
@DisplayName("200 티켓 개수 확인 성공 및 setupTicket 확인")
void findTicketCountSetupFalseSuccess() throws Exception {
//given
ticketFixture.createTicket(seoulUserAgendaProfile);
ticketFixture.createTicket(seoulUserAgendaProfile);

//when
String res = mockMvc.perform(
get("/agenda/ticket")
.header("Authorization", "Bearer " + seoulUserAccessToken)
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andReturn().getResponse().getContentAsString();
TicketCountResDto result = objectMapper.readValue(res, TicketCountResDto.class);
//then
assertThat(result.getTicketCount()).isEqualTo(2);
assertThat(result.isSetupTicket()).isFalse();
}

@Test
Expand Down Expand Up @@ -269,7 +290,7 @@ void findTicketHistorySuccessToUsed() throws Exception {
.param("size", String.valueOf(req.getSize())))
.andExpect(status().isOk()).andReturn().getResponse().getContentAsString();
PageResponseDto<TicketHistoryResDto> pageResponseDto = objectMapper.readValue(res, new TypeReference<>() {
});
});
List<TicketHistoryResDto> result = pageResponseDto.getContent();

//then
Expand Down

0 comments on commit 5e46603

Please sign in to comment.