Program: 130850
Project: 130850
Buggy source:
@Test public void retryOnInvalidToken() throws Exception {
  final HttpClient httpClient=new HttpClient(){
    private boolean tokenIsValid=true;
    @Override public CompletionStage<HttpResponse> execute(    final HttpRequest httpRequest){
      return CompletableFutureUtils.successful(executeSync(httpRequest));
    }
    private HttpResponse executeSync(    final HttpRequest httpRequest){
      if (httpRequest.getUrl().contains("String_Node_Str")) {
        if (tokenIsValid) {
          return HttpResponse.of(200,String.format("String_Node_Str",getSphereClientConfig().getProjectKey()));
        }
 else {
          tokenIsValid=true;
          return HttpResponse.of(200,String.format("String_Node_Str",getSphereClientConfig().getProjectKey()));
        }
      }
      if (httpRequest.getUrl().contains("String_Node_Str")) {
        tokenIsValid=false;
        return HttpResponse.of(404);
      }
      if (httpRequest.getUrl().contains("String_Node_Str")) {
        if (tokenIsValid && httpRequest.getHeaders().getHeader(HttpHeaders.AUTHORIZATION).get(0).equals("String_Node_Str")) {
          return HttpResponse.of(404);
        }
 else {
          return HttpResponse.of(401,"String_Node_Str");
        }
      }
      return HttpResponse.of(500);
    }
    @Override public void close(){
    }
  }
;
  final SphereAccessTokenSupplier tokenSupplier=SphereAccessTokenSupplier.ofAutoRefresh(getSphereClientConfig(),httpClient,false);
  try (final SphereClient client=SphereClient.of(getSphereClientConfig(),httpClient,tokenSupplier)){
    assertThat(client.execute(CategoryByIdGet.of("String_Node_Str")).toCompletableFuture().join()).isNull();
    assertThat(client.execute(ChannelByIdGet.of("String_Node_Str")).toCompletableFuture().join()).isNull();
  }
 }

Fixed version (ground truth):
@Test public void retryOnInvalidToken() throws Exception {
  final HttpClient httpClient=new HttpClient(){
    private volatile boolean tokenIsValid=true;
    @Override public CompletionStage<HttpResponse> execute(    final HttpRequest httpRequest){
      return CompletableFutureUtils.successful(executeSync(httpRequest));
    }
    private HttpResponse executeSync(    final HttpRequest httpRequest){
      if (httpRequest.getUrl().contains("String_Node_Str")) {
        if (tokenIsValid) {
          return HttpResponse.of(200,String.format("String_Node_Str",getSphereClientConfig().getProjectKey()));
        }
 else {
          tokenIsValid=true;
          return HttpResponse.of(200,String.format("String_Node_Str",getSphereClientConfig().getProjectKey()));
        }
      }
      if (httpRequest.getUrl().contains("String_Node_Str")) {
        tokenIsValid=false;
        return HttpResponse.of(404);
      }
      if (httpRequest.getUrl().contains("String_Node_Str")) {
        if (tokenIsValid && httpRequest.getHeaders().getHeader(HttpHeaders.AUTHORIZATION).get(0).equals("String_Node_Str")) {
          return HttpResponse.of(404);
        }
 else {
          return HttpResponse.of(401,"String_Node_Str");
        }
      }
      return HttpResponse.of(500);
    }
    @Override public void close(){
    }
  }
;
  final SphereAccessTokenSupplier tokenSupplier=SphereAccessTokenSupplier.ofAutoRefresh(getSphereClientConfig(),httpClient,false);
  try (final SphereClient client=SphereClient.of(getSphereClientConfig(),httpClient,tokenSupplier)){
    assertThat(client.execute(CategoryByIdGet.of("String_Node_Str")).toCompletableFuture().join()).isNull();
    assertThat(client.execute(ChannelByIdGet.of("String_Node_Str")).toCompletableFuture().join()).isNull();
  }
 }