Skip to content

Commit

Permalink
refactor: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Angular2Guy committed Jul 14, 2024
1 parent 1bd733e commit 8bd1d76
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -69,8 +66,6 @@ public class ActorControllerTest {
@MockBean
private DefaultMapper mapper;

@MockBean
private UserDetailService auds;

@MockBean
private JwtTokenService jwtTokenService;
Expand All @@ -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();
Expand Down

0 comments on commit 8bd1d76

Please sign in to comment.