### Question:
SecurityRestServiceImpl implements SecurityRestService { @Override @PermitAll public CsrfToken getCsrfToken(HttpServletRequest request, HttpServletResponse response) { CsrfToken token = this.csrfTokenRepository.loadToken(request); if (token == null) { LOG.error("No CsrfToken could be found - instantiating a new Token"); token = this.csrfTokenRepository.generateToken(request); this.csrfTokenRepository.saveToken(token, request, response); } return token; }  @Override @PermitAll CsrfToken getCsrfToken(HttpServletRequest request, HttpServletResponse response); @Override @PermitAll UserProfileTo getCurrentUser(); @Inject void setCsrfTokenRepository(CsrfTokenRepository csrfTokenRepository);  }### Answer:
@Test public void testGetCsrfToken() { String login = "admin"; String password = "admin"; SecurityRestService securityService = getServiceClientFactory().create(SecurityRestService.class, new ServiceClientConfigBuilder().host("localhost").authBasic().userLogin(login).userPassword(password) .buildMap()); CsrfToken csrfToken = securityService.getCsrfToken(null, null); assertThat(csrfToken.getHeaderName()).isEqualTo("X-CSRF-TOKEN"); assertThat(csrfToken.getParameterName()).isEqualTo("_csrf"); assertThat(csrfToken.getToken()).isNotNull(); LOG.debug("Csrf Token: {}", csrfToken.getToken()); }
@Test public void testGetCsrfToken() { String login = "waiter"; String password = "waiter"; SecurityRestService securityService = getServiceClientFactory().create(SecurityRestService.class, new ServiceClientConfigBuilder().host("localhost").authBasic().userLogin(login).userPassword(password) .buildMap()); CsrfToken csrfToken = securityService.getCsrfToken(null, null); assertThat(csrfToken.getHeaderName()).isEqualTo("X-CSRF-TOKEN"); assertThat(csrfToken.getParameterName()).isEqualTo("_csrf"); assertThat(csrfToken.getToken()).isNotNull(); LOG.debug("Csrf Token: {}", csrfToken.getToken()); }