DefaultUserAuthService implements UserAuthService { @Override public User getAuthenticatedUser() { return userService.getUserById(retriever.getUserId()); } DefaultUserAuthService(UserService userService, AuthenticationInfoRetriever retriever); @Override User getAuthenticatedUser(); @Override String getAuthenticatedUserId(); @Override boolean authenticatedUserIsAdmin(); @Override boolean userIsEffectivelyAManager(User user);  }
@Test public void getAuthenticatedUserReturnsUserWithIdOfAuthenticatedUser() { given(retrieverMock.getUserId()).willReturn(USER_ID); given(userServiceMock.getUserById(USER_ID)).willReturn(userMock); var actualUser = userAuthService.getAuthenticatedUser(); assertThat(actualUser).isEqualTo(userMock); }