From 8bd1d766e88d56d315e3bec9e672181375f6ffdb Mon Sep 17 00:00:00 2001 From: Angular2guy Date: Sun, 14 Jul 2024 10:16:36 +0200 Subject: [PATCH] refactor: clean up --- .../moviemanager/adapter/controller/ActorController.java | 4 +--- .../adapter/controller/ActorControllerTest.java | 6 ------ 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/backend/src/main/java/ch/xxx/moviemanager/adapter/controller/ActorController.java b/backend/src/main/java/ch/xxx/moviemanager/adapter/controller/ActorController.java index 9b37240..e571302 100644 --- a/backend/src/main/java/ch/xxx/moviemanager/adapter/controller/ActorController.java +++ b/backend/src/main/java/ch/xxx/moviemanager/adapter/controller/ActorController.java @@ -40,12 +40,10 @@ public class ActorController { private final ActorService service; private final DefaultMapper mapper; - private final UserDetailService auds; - public ActorController(ActorService service, DefaultMapper mapper, UserDetailService auds) { + public ActorController(ActorService service, DefaultMapper mapper) { this.service = service; this.mapper = mapper; - this.auds = auds; } @RequestMapping(value = "/{name}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) diff --git a/backend/src/test/java/ch/xxx/moviemanager/adapter/controller/ActorControllerTest.java b/backend/src/test/java/ch/xxx/moviemanager/adapter/controller/ActorControllerTest.java index 32cc123..6bec07d 100644 --- a/backend/src/test/java/ch/xxx/moviemanager/adapter/controller/ActorControllerTest.java +++ b/backend/src/test/java/ch/xxx/moviemanager/adapter/controller/ActorControllerTest.java @@ -42,14 +42,11 @@ import ch.xxx.moviemanager.domain.model.dto.ActorFilterCriteriaDto; import ch.xxx.moviemanager.domain.model.dto.SearchTermDto; import ch.xxx.moviemanager.domain.model.entity.Actor; -import ch.xxx.moviemanager.domain.model.entity.Cast; -import ch.xxx.moviemanager.domain.model.entity.Movie; import ch.xxx.moviemanager.domain.model.entity.User; import ch.xxx.moviemanager.domain.utils.JwtUtils; import ch.xxx.moviemanager.usecase.mapper.DefaultMapper; import ch.xxx.moviemanager.usecase.service.ActorService; import ch.xxx.moviemanager.usecase.service.JwtTokenService; -import ch.xxx.moviemanager.usecase.service.UserDetailService; import jakarta.servlet.http.HttpServletRequest; @WebMvcTest(controllers = ActorController.class, includeFilters = @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = { @@ -69,8 +66,6 @@ public class ActorControllerTest { @MockBean private DefaultMapper mapper; - @MockBean - private UserDetailService auds; @MockBean private JwtTokenService jwtTokenService; @@ -90,7 +85,6 @@ public void init() { Mockito.when(this.jwtTokenService.getAuthentication(any(String.class))).thenCallRealMethod(); Mockito.when(this.jwtTokenService.getUsername(any(String.class))).thenReturn("XXX"); Mockito.when(this.jwtTokenService.getAuthorities(any(String.class))).thenReturn(List.of(Role.USERS)); - Mockito.when(this.auds.getCurrentUser(any(String.class))).thenReturn(user); ReflectionTestUtils.setField(this.jwtTokenService, "secretKey", TEST_SECRECT_KEY); Mockito.doCallRealMethod().when(this.jwtTokenService).init(); this.jwtTokenService.init();