Skip to content

Commit

Permalink
update displayname for enchance readability
Browse files Browse the repository at this point in the history
  • Loading branch information
ce-pong committed Feb 26, 2024
1 parent f0309ee commit a2e2308
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class LotteryControllerTest {
private ObjectMapper objectMapper;

@Test
@DisplayName("Call Get Available Ticket Should Return Status Code 200 and Correct Lottery List Response")
@DisplayName("getAvailableTickets Should Return Status Code 200 and Correct Lottery List Response")
public void getAvailableTickets_ShouldReturn200AndLotteryListResponse() throws Exception {
// Arrange
when(lotteryService.getAvailableTicketIds()).thenReturn(new LotteryListResponse(List.of("000001", "000002", "123456")));
Expand All @@ -54,8 +54,8 @@ public void getAvailableTickets_ShouldReturn200AndLotteryListResponse() throws E
}

@Test
@DisplayName("Handling Internal Server Error When Retrieving Available Tickets should return status code 500 and defined message")
public void whenInternalServerOccur_ShouldReturn500AndDefinedMessage() throws Exception {
@DisplayName("getAvailableTickets returns status 500 and error message on internal server error")
public void getAvailableTickets_OnInternalServerError_ShouldReturnStatus500AndErrorMessage() throws Exception {

// Arrange
when(lotteryService.getAvailableTicketIds()).thenThrow(new InternalServerException("Failed to get available ticket"));
Expand All @@ -67,7 +67,7 @@ public void whenInternalServerOccur_ShouldReturn500AndDefinedMessage() throws Ex
}

@Test
@DisplayName("Create Lottery Attached Basic Auth (Admin) should return status code 201 and correct response")
@DisplayName("CreateLottery Attached Basic Auth (Admin) should return status code 201 and correct response")
public void createTicket_ShouldReturn201AndResponseContainTicketId() throws Exception {

// Arrange
Expand All @@ -87,7 +87,7 @@ public void createTicket_ShouldReturn201AndResponseContainTicketId() throws Exce
}

@Test
@DisplayName("Create Lottery with invalid data should return status code 400")
@DisplayName("CreateLottery with invalid data should return status code 400")
public void createTicket_withInvalidData_ShouldReturn400() throws Exception {

// Arrange
Expand All @@ -101,7 +101,6 @@ public void createTicket_withInvalidData_ShouldReturn400() throws Exception {
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.message").value("Validation error"));

}


Expand Down

0 comments on commit a2e2308

Please sign in to comment.