Skip to content

Commit

Permalink
AYS-550 | Controller Tests Have Been Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
egehanasal committed Nov 24, 2024
1 parent 6ea4866 commit 8851025
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -768,4 +768,49 @@ void givenValidAdminRegisterApplicationRejectRequest_whenUnauthorizedForRejectin
.reject(Mockito.eq(mockId), Mockito.any(AdminRegistrationApplicationRejectRequest.class));
}

@ParameterizedTest
@ValueSource(strings = {
"",
" ",
"less than 40",
"""
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor.
Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Donec qudam felis, ultricies nec, pellentesque eu, pretscsxwium quis, sem. Nulla consequat massa quis
enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut,
imperdiet a, venenatdskjvndshjcndsis vitae, justo. Nullam dictum felis eu pedde mollis pretium. Integer tincidunt.
Cras dapibus. Vivdamus ewl
""",
" spaceAtTheBeginning",
"spaceAtTheEnd ",
" both ",
" justAString "
})
void givenValidAdminRegisterApplicationRejectRequest_whenRejectingAdminRegisterApplication_thenReturnValidationError(String reason) throws Exception {

// Given
String mockId = "4d04bd1e-6318-43ba-ab40-57efb8afc918";
AdminRegistrationApplicationRejectRequest mockRequest = new AdminRegistrationApplicationRejectRequestBuilder()
.withValidValues()
.withRejectReason(reason)
.build();

// Then
String endpoint = BASE_PATH.concat("/admin-registration-application/").concat(mockId).concat("/reject");
MockHttpServletRequestBuilder mockHttpServletRequestBuilder = AysMockMvcRequestBuilders
.post(endpoint, mockUserToken.getAccessToken(), mockRequest);

AysErrorResponse mockErrorResponse = AysErrorResponseBuilder.VALIDATION_ERROR;

aysMockMvc.perform(mockHttpServletRequestBuilder, mockErrorResponse)
.andExpect(AysMockResultMatchersBuilders.status()
.isBadRequest())
.andExpect(AysMockResultMatchersBuilders.subErrors()
.isNotEmpty());

// Verify
Mockito.verify(adminRegistrationApplicationService, Mockito.never())
.reject(Mockito.anyString(), Mockito.any());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,7 @@ void givenInvalidEmergencyEvacuationApplicationListRequest_whenReferenceNumberNo
".,..,.,.,.,.,,.,.,.,.,.,.,.,.,..,.,.,,.,.,.,",
"t",
"151201485621548562154851458614125461254125412",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam In hac habitasse platea dictumst. Nullam in turpis at nunc ultrices.",
" spaceAtTheBeginning",
"spaceAtTheEnd ",
" both ",
" justAString "
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam In hac habitasse platea dictumst. Nullam in turpis at nunc ultrices."
})
void givenInvalidEmergencyEvacuationApplicationListRequest_whenSourceCityNotValid_thenReturnValidationError(String sourceCity) throws Exception {

Expand Down Expand Up @@ -173,11 +169,7 @@ void givenInvalidEmergencyEvacuationApplicationListRequest_whenSourceCityNotVali
".,..,.,.,.,.,,.,.,.,.,.,.,.,.,..,.,.,,.,.,.,",
"t",
"151201485621548562154851458614125461254125412",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam In hac habitasse platea dictumst. Nullam in turpis at nunc ultrices.",
" spaceAtTheBeginning",
"spaceAtTheEnd ",
" both ",
" justAString ",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam In hac habitasse platea dictumst. Nullam in turpis at nunc ultrices."
})
void givenInvalidEmergencyEvacuationApplicationListRequest_whenSourceDistrictNotValid_thenReturnValidationError(String sourceDistrict) throws Exception {

Expand Down Expand Up @@ -245,11 +237,7 @@ void givenInvalidEmergencyEvacuationApplicationListRequest_whenSeatingCountNotVa
".,..,.,.,.,.,,.,.,.,.,.,.,.,.,..,.,.,,.,.,.,",
"t",
"151201485621548562154851458614125461254125412",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam In hac habitasse platea dictumst. Nullam in turpis at nunc ultrices.",
" spaceAtTheBeginning",
"spaceAtTheEnd ",
" both ",
" justAString ",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam In hac habitasse platea dictumst. Nullam in turpis at nunc ultrices."
})
void givenInvalidEmergencyEvacuationApplicationListRequest_whenTargetCityNotValid_thenReturnValidationError(String targetCity) throws Exception {

Expand Down Expand Up @@ -285,11 +273,7 @@ void givenInvalidEmergencyEvacuationApplicationListRequest_whenTargetCityNotVali
".,..,.,.,.,.,,.,.,.,.,.,.,.,.,..,.,.,,.,.,.,",
"t",
"151201485621548562154851458614125461254125412",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam In hac habitasse platea dictumst. Nullam in turpis at nunc ultrices.",
" spaceAtTheBeginning",
"spaceAtTheEnd ",
" both ",
" justAString ",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam In hac habitasse platea dictumst. Nullam in turpis at nunc ultrices."
})
void givenInvalidEmergencyEvacuationApplicationListRequest_whenTargetDistrictNotValid_thenReturnValidationError(String targetDistrict) throws Exception {

Expand Down Expand Up @@ -1124,7 +1108,11 @@ void givenValidIdAndUpdateRequest_whenStatusDoesNotValid_thenReturnValidationErr
"""
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.
"""
""",
" spaceAtTheBeginning",
"spaceAtTheEnd ",
" both ",
" justAString "
})
void givenValidIdAndUpdateRequest_whenNotesDoesNotValid_thenReturnValidationError(String mockNotes) throws Exception {
// Given
Expand Down

0 comments on commit 8851025

Please sign in to comment.