public Result waitForCondition(Config config, Supplier<Boolean>... conditionCheck) {
    return finishOrTimeout(
        config,
        conditionCheck,
        () -> jobIsDoneOrFinishing(config.project(), config.region(), config.jobId()));
  }
@Test
  public void testWaitForCondition() throws IOException {
    AtomicInteger callCount = new AtomicInteger();
    int totalCalls = 3;
    Supplier<Boolean> checker = () -> callCount.incrementAndGet() >= totalCalls;
    when(client.getJobStatus(any(), any(), any()))
        .thenReturn(JobState.RUNNING)
        .thenThrow(new IOException())
        .thenReturn(JobState.RUNNING);

    Result result = new PipelineOperator(client).waitForCondition(DEFAULT_CONFIG, checker);

    verify(client, atMost(totalCalls))
        .getJobStatus(projectCaptor.capture(), regionCaptor.capture(), jobIdCaptor.capture());
    assertThat(projectCaptor.getValue()).isEqualTo(PROJECT);
    assertThat(regionCaptor.getValue()).isEqualTo(REGION);
    assertThat(jobIdCaptor.getValue()).isEqualTo(JOB_ID);
    assertThat(result).isEqualTo(Result.CONDITION_MET);
  }