@Test
public void testWaitForJobCompletionChange() throws Exception {

  // Return unfinished job the return finished job.
  when(mockJobsGet.execute()).thenReturn(notDoneJob).thenReturn(job);
  // Run waitForJobCompletion.
  BigQueryUtils.waitForJobCompletion(mockBigQuery, projectId, jobReference, mockProgressable);
  // Verify that the method terminates and that the correct calls were sent to the mock BigQuery.
  verify(mockBigQuery, times(2)).jobs();
  verify(mockBigQueryJobs, times(2)).get(projectId, jobReference.getJobId());
  verify(mockJobsGet, times(2)).execute();
  verify(mockProgressable, atLeastOnce()).progress();
}