diff --git a/goofy-server/src/test/java/de/itvsh/goofy/RootControllerTest.java b/goofy-server/src/test/java/de/itvsh/goofy/RootControllerTest.java index 47a5d3f7592b9dc40d35eb5626192f912b7ebe0f..04699e4914dc796f27c3c57570ada758855e5259 100644 --- a/goofy-server/src/test/java/de/itvsh/goofy/RootControllerTest.java +++ b/goofy-server/src/test/java/de/itvsh/goofy/RootControllerTest.java @@ -35,6 +35,8 @@ import de.itvsh.goofy.system.SystemStatusService; class RootControllerTest { private static final String SEARCH_BY = "/test?searchBy={searchBy}"; + private static final String API_USER_PROFILES_TEMLPATE = "/api/userProfiles/%s"; + private static final String API_USER_PROFILES = "/api/userProfiles/"; private static final String USERMANAGER_URL = "http://localhost:8080"; private final String PATH = "/api"; @@ -231,13 +233,13 @@ class RootControllerTest { class UsermanagerUrlConfigured { @Test void shouldHaveCurrentUserLink() { - when(controller.getUserProfilesUrl()).thenReturn(Optional.of("http://localhost:9092/api/userProfiles/%s")); + when(controller.getUserProfilesUrl()).thenReturn(Optional.of(USERMANAGER_URL + API_USER_PROFILES_TEMLPATE)); when(currentUserService.getUserId()).thenReturn(GoofyUserTestFactory.ID); var model = controller.getRootResource(); assertThat(model.getLink(RootController.REL_CURRENT_USER)).isPresent().get().extracting(Link::getHref) - .isEqualTo(Link.of("http://localhost:9092/api/userProfiles/" + GoofyUserTestFactory.ID, RootController.REL_CURRENT_USER) + .isEqualTo(Link.of(USERMANAGER_URL + API_USER_PROFILES + GoofyUserTestFactory.ID, RootController.REL_CURRENT_USER) .getHref()); } } @@ -257,10 +259,11 @@ class RootControllerTest { @DisplayName("when external Id cannot resolved to internal id") @Nested class NoInternalUserId { + @BeforeEach void init() { doReturn(true).when(controller).hasVerwaltungRole(); - when(controller.getUserProfilesUrl()).thenReturn(Optional.of("http://localhost/api/userProfiles/%s")); + when(controller.getUserProfilesUrl()).thenReturn(Optional.of(USERMANAGER_URL + API_USER_PROFILES)); when(internalUserIdService.getUserId(any())).thenReturn(Optional.empty()); }