### Question:
SecurityContextServiceImpl implements SecurityContextService { @Override public boolean isUserFullyAuthenticated() { return isUserFullyAuthenticated(securityContextHolder.getContext().getAuthentication()); } SecurityContextServiceImpl(final SecurityContextHolderSpringDelegate securityContextHolder, final ProfileService profileService); @Override Optional<Authentication> getLoggedInUser(); @Override boolean isUserFullyAuthenticated(); @Override Optional<UserProfile> getLoggedInUserProfile();  }### Answer:
@Test public void isUserFullyAuthenticated() { final Authentication authentication = mock(Authentication.class); when(authentication.isAuthenticated()).thenReturn(true); when(securityContextHolder.getContext().getAuthentication()).thenReturn(authentication); final boolean result = securityContextService.isUserFullyAuthenticated(); assertThat(result).isTrue(); }
@Test public void isUserFullyAuthenticated_noAuthentication() { when(securityContextHolder.getContext().getAuthentication()).thenReturn(null); final boolean result = securityContextService.isUserFullyAuthenticated(); assertThat(result).isFalse(); }
@Test public void isUserFullyAuthenticated_notAuthentciated() { final Authentication authentication = mock(Authentication.class); when(authentication.isAuthenticated()).thenReturn(false); when(securityContextHolder.getContext().getAuthentication()).thenReturn(authentication); final boolean result = securityContextService.isUserFullyAuthenticated(); assertThat(result).isFalse(); }
@Test public void isUserFullyAuthenticated_AnonymousAuthenticationToken() { final Authentication authentication = spy(new AnonymousAuthenticationToken("dssg", "htesn", Arrays.asList((GrantedAuthority) () -> "dhfgj", (GrantedAuthority) () -> "dhfc"))); when(authentication.isAuthenticated()).thenReturn(true); when(securityContextHolder.getContext().getAuthentication()).thenReturn(authentication); final boolean result = securityContextService.isUserFullyAuthenticated(); assertThat(result).isFalse(); }