-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b2f093
commit d402120
Showing
1 changed file
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -644,7 +644,7 @@ void updateStatusWithApprovedStatusDECLINED() throws Exception { | |
} | ||
|
||
@Test | ||
void updateStatusDoesNotSendNotificationButSavesDataWhenStatusIsOther() throws Exception { | ||
void updateStatusDoesNotSendNotificationButSavesDataWhenStatusIsPROPOSED() throws Exception { | ||
UpdatePlaceStatusWithUserEmailDto dto = new UpdatePlaceStatusWithUserEmailDto(); | ||
dto.setPlaceName("testPlace"); | ||
dto.setNewStatus(PlaceStatus.PROPOSED); | ||
|
@@ -674,4 +674,34 @@ void updateStatusDoesNotSendNotificationButSavesDataWhenStatusIsOther() throws E | |
.sendEmailNotificationChangesPlaceStatus(any(UpdatePlaceStatusWithUserEmailDto.class)); | ||
} | ||
|
||
@Test | ||
void updateStatusDoesNotSendNotificationButSavesDataWhenStatusIsDELETED() throws Exception { | ||
UpdatePlaceStatusWithUserEmailDto dto = new UpdatePlaceStatusWithUserEmailDto(); | ||
dto.setPlaceName("testPlace"); | ||
dto.setNewStatus(PlaceStatus.DELETED); | ||
dto.setUserName("testUser"); | ||
dto.setEmail("[email protected]"); | ||
Place place = new Place(); | ||
place.setId(1L); | ||
place.setName("testPlace"); | ||
place.setStatus(PlaceStatus.PROPOSED); | ||
when(placeService.updatePlaceStatus(any(UpdatePlaceStatusWithUserEmailDto.class))).thenReturn(dto); | ||
String json = """ | ||
{ | ||
"placeName": "testPlace", | ||
"newStatus": "PROPOSED", | ||
"userName": "testUser", | ||
"email": "[email protected]" | ||
} | ||
"""; | ||
|
||
mockMvc.perform(patch(placeLink + "/status") | ||
.contentType(MediaType.APPLICATION_JSON) | ||
.content(json)) | ||
.andExpect(status().isOk()) | ||
.andExpect(content().string("Status updated successfully for place: testPlace")); | ||
verify(placeService, times(1)).updatePlaceStatus(any(UpdatePlaceStatusWithUserEmailDto.class)); | ||
verify(restClient, times(0)) | ||
.sendEmailNotificationChangesPlaceStatus(any(UpdatePlaceStatusWithUserEmailDto.class)); | ||
} | ||
} |