### Question:
SecurityRestServiceImpl implements SecurityRestService { @Override @PermitAll public UserProfileTo getCurrentUser() { SecurityContext context = SecurityContextHolder.getContext(); Authentication authentication = null; if (context != null) { authentication = context.getAuthentication(); } if (authentication == null) { throw new NoActiveUserException(); } UserProfileTo profile = new UserProfileTo(); profile.setLogin(authentication.getPrincipal().toString()); return profile; }  @Override @PermitAll CsrfToken getCsrfToken(HttpServletRequest request, HttpServletResponse response); @Override @PermitAll UserProfileTo getCurrentUser(); @Inject void setCsrfTokenRepository(CsrfTokenRepository csrfTokenRepository);  }### Answer:
@Test public void testGetCurrentUser() { String login = "admin"; String password = "admin"; SecurityRestService securityService = getServiceClientFactory().create(SecurityRestService.class, new ServiceClientConfigBuilder().host("localhost").authBasic().userLogin(login).userPassword(password) .buildMap()); UserProfileTo userProfile = securityService.getCurrentUser(); assertThat(userProfile.getLogin()).isEqualTo(login); }