From bb3098c285fe80ce885c428368ec8990819ee774 Mon Sep 17 00:00:00 2001 From: PhilippFruh Date: Wed, 12 Oct 2022 12:38:32 +0200 Subject: [PATCH] fix: adapt tests --- .../api/facade/userdata/ConsultantDataFacade.java | 8 ++------ .../web/controller/UserControllerSessionE2EIT.java | 3 +++ .../api/facade/userdata/ConsultantDataFacadeTest.java | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/de/caritas/cob/userservice/api/facade/userdata/ConsultantDataFacade.java b/src/main/java/de/caritas/cob/userservice/api/facade/userdata/ConsultantDataFacade.java index 18dddc78c..88f13ee2d 100644 --- a/src/main/java/de/caritas/cob/userservice/api/facade/userdata/ConsultantDataFacade.java +++ b/src/main/java/de/caritas/cob/userservice/api/facade/userdata/ConsultantDataFacade.java @@ -40,8 +40,7 @@ public Consultant updateConsultantAbsent(Consultant consultant, AbsenceDTO absen return this.consultantService.saveConsultant(consultant); } - public GroupSessionListResponseDTO addConsultantDisplayNameToSessionList( - GroupSessionListResponseDTO groupSessionList) { + public void addConsultantDisplayNameToSessionList(GroupSessionListResponseDTO groupSessionList) { groupSessionList .getSessions() .forEach( @@ -55,11 +54,9 @@ public GroupSessionListResponseDTO addConsultantDisplayNameToSessionList( consultant.setDisplayName(userDtoMapper.displayNameOf(consultantMap))); } }); - return groupSessionList; } - public UserSessionListResponseDTO addConsultantDisplayNameToSessionList( - UserSessionListResponseDTO userSessionsDTO) { + public void addConsultantDisplayNameToSessionList(UserSessionListResponseDTO userSessionsDTO) { userSessionsDTO .getSessions() .forEach( @@ -73,6 +70,5 @@ public UserSessionListResponseDTO addConsultantDisplayNameToSessionList( consultant.setDisplayName(userDtoMapper.displayNameOf(consultantMap))); } }); - return userSessionsDTO; } } diff --git a/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerSessionE2EIT.java b/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerSessionE2EIT.java index a909004db..9ca66d560 100644 --- a/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerSessionE2EIT.java +++ b/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerSessionE2EIT.java @@ -55,6 +55,7 @@ import de.caritas.cob.userservice.api.config.auth.IdentityConfig; import de.caritas.cob.userservice.api.config.auth.UserRole; import de.caritas.cob.userservice.api.exception.rocketchat.RocketChatUserNotInitializedException; +import de.caritas.cob.userservice.api.facade.userdata.ConsultantDataFacade; import de.caritas.cob.userservice.api.helper.AuthenticatedUser; import de.caritas.cob.userservice.api.helper.CustomLocalDateTime; import de.caritas.cob.userservice.api.helper.UsernameTranscoder; @@ -162,6 +163,8 @@ class UserControllerSessionE2EIT { @MockBean private RocketChatCredentialsProvider rocketChatCredentialsProvider; + @MockBean private ConsultantDataFacade consultantDataFacade; + @MockBean @Qualifier("restTemplate") private RestTemplate restTemplate; diff --git a/src/test/java/de/caritas/cob/userservice/api/facade/userdata/ConsultantDataFacadeTest.java b/src/test/java/de/caritas/cob/userservice/api/facade/userdata/ConsultantDataFacadeTest.java index d5b827abf..c44fd9eff 100644 --- a/src/test/java/de/caritas/cob/userservice/api/facade/userdata/ConsultantDataFacadeTest.java +++ b/src/test/java/de/caritas/cob/userservice/api/facade/userdata/ConsultantDataFacadeTest.java @@ -102,7 +102,7 @@ public void addConsultantDisplayNameToSessionList_GroupSession_Should_AddConsult when(userDtoMapper.displayNameOf(map)).thenReturn(displayName); when(accountManager.findConsultantByUsername(userName)).thenReturn(Optional.of(map)); - response = consultantDataFacade.addConsultantDisplayNameToSessionList(response); + consultantDataFacade.addConsultantDisplayNameToSessionList(response); assertEquals(displayName, response.getSessions().get(0).getConsultant().getDisplayName()); } @@ -123,7 +123,7 @@ public void addConsultantDisplayNameToSessionList_UserSession_Should_AddConsulta when(userDtoMapper.displayNameOf(map)).thenReturn(displayName); when(accountManager.findConsultantByUsername(userName)).thenReturn(Optional.of(map)); - response = consultantDataFacade.addConsultantDisplayNameToSessionList(response); + consultantDataFacade.addConsultantDisplayNameToSessionList(response); assertEquals(displayName, response.getSessions().get(0).getConsultant().getDisplayName()); }