public String getClientReturnId(String sessionId) {
        Optional<OpenIdSession> session = openIdRepository.findById(sessionId);

        if (session.isEmpty()) return null;

        OpenIdSession openIdSession = session.get();

        var returnUrl = openIdSession.getRedirectUri() + "?state=" + openIdSession.getState();
        if (!"success".equals(openIdSession.getAuthenticationState())) {
            return returnUrl + "&error=CANCELLED";
        }

        return returnUrl + "&code=" + openIdSession.getCode();
    }
@Test
    void getClientReturnIdTest() {
        OpenIdSession openIdSession = new OpenIdSession();
        openIdSession.setSessionId("sessionId");
        openIdSession.setRedirectUri("testRedirectUrl");
        openIdSession.setState("testState");
        openIdSession.setCode("testCode");
        openIdSession.setAuthenticationState("success");
        when(httpServletRequest.getSession()).thenReturn(httpSession);
        when(openIdRepository.findById(anyString())).thenReturn(Optional.of(openIdSession));

        String response = openIdService.getClientReturnId("sessionId");

        assertEquals("testRedirectUrl?state=testState&code=testCode", response);
    }