@GET
  @Path("/callback")
  @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
  public Response callback(
      @CookieParam("session_id") String sessionId, @QueryParam("code") String code) {

    var redirect = authService.callback(new CallbackRequest(sessionId, code));
    return Response.seeOther(redirect).build();
  }
@Test
  void callback_success() {

    var callbackRedirect = URI.create("https://app.example.com/success");
    var authService = mock(AuthService.class);
    when(authService.callback(any())).thenReturn(callbackRedirect);
    var sut = new AuthEndpoint(authService);

    // when
    try (var res = sut.callback(null, null)) {

      // then
      assertEquals(Status.SEE_OTHER.getStatusCode(), res.getStatus());
      var redirect = res.getLocation().toString();
      assertEquals(callbackRedirect.toString(), redirect);
    }
  }