@@ -214,7 +214,7 @@ public void testExecSlowQueryPath() throws SQLException, InterruptedException {
214214 .build ();
215215 Job job = getJobMock (tableResult , queryJobConfiguration , StatementType .SELECT );
216216
217- doReturn (job ).when (bigquery ).create (any (JobInfo . class ));
217+ doReturn (job ).when (bigquery ).queryWithTimeout (any (), any (), any ( ));
218218
219219 doReturn (jobIdWrapper )
220220 .when (bigQueryStatementSpy )
@@ -299,14 +299,14 @@ public void setQueryTimeoutTest() throws Exception {
299299 QueryJobConfiguration .newBuilder (query ).setJobTimeoutMs (10000L ).build ();
300300
301301 Job job = getJobMock (result , jobConfiguration , StatementType .SELECT );
302- doReturn (job ).when (bigquery ).create (any (JobInfo . class ));
302+ doReturn (job ).when (bigquery ).queryWithTimeout (any (), any (), any ( ));
303303
304304 doReturn (jsonResultSet ).when (bigQueryStatementSpy ).processJsonResultSet (result );
305- ArgumentCaptor <JobInfo > captor = ArgumentCaptor .forClass (JobInfo .class );
305+ ArgumentCaptor <QueryJobConfiguration > captor = ArgumentCaptor .forClass (QueryJobConfiguration .class );
306306
307307 bigQueryStatementSpy .runQuery (query , jobConfiguration );
308- verify (bigquery ).create (captor .capture ());
309- QueryJobConfiguration jobConfig = captor .getValue (). getConfiguration () ;
308+ verify (bigquery ).queryWithTimeout (captor .capture (), any (), any ());
309+ QueryJobConfiguration jobConfig = captor .getValue ();
310310 assertEquals (3000L , jobConfig .getJobTimeoutMs ().longValue ());
311311 }
312312
@@ -395,23 +395,16 @@ public void testJoblessQuery() throws SQLException, InterruptedException {
395395 TableResult tableResultJobfulMock = mock (TableResult .class );
396396 QueryJobConfiguration jobConf = QueryJobConfiguration .newBuilder ("SELECT 1" ).build ();
397397 Job jobMock = getJobMock (tableResultJobfulMock , jobConf , StatementType .SELECT );
398- ArgumentCaptor <JobInfo > jobfulCaptor = ArgumentCaptor .forClass (JobInfo .class );
399- doReturn (jobMock ).when (bigquery ).create (jobfulCaptor .capture ());
398+ doReturn (jobMock )
399+ .when (bigquery )
400+ .queryWithTimeout (any (QueryJobConfiguration .class ), any (), any ());
400401 doReturn (mock (BigQueryJsonResultSet .class ))
401402 .when (jobfulStatementSpy )
402403 .processJsonResultSet (tableResultJobfulMock );
403404
404405 jobfulStatementSpy .executeQuery ("SELECT 1" );
405406
406- verify (bigquery ).create (any (JobInfo .class ));
407- assertTrue (
408- jobfulCaptor .getAllValues ().stream ()
409- .noneMatch (
410- jobInfo ->
411- Boolean .TRUE .equals (
412- ((QueryJobConfiguration ) jobInfo .getConfiguration ()).dryRun ())));
413- verify (bigquery , Mockito .never ())
414- .queryWithTimeout (any (QueryJobConfiguration .class ), any (), any ());
407+ verify (bigquery ).queryWithTimeout (any (QueryJobConfiguration .class ), any (), any ());
415408 }
416409
417410 @ Test
@@ -424,7 +417,7 @@ public void testCloseCancelsJob() throws SQLException, InterruptedException {
424417 QueryJobConfiguration .newBuilder (query ).setPriority (Priority .BATCH ).build ();
425418 Job job = getJobMock (tableResult , queryJobConfiguration , StatementType .SELECT );
426419
427- doReturn (job ).when (bigquery ).create (any (JobInfo . class ));
420+ doReturn (job ).when (bigquery ).queryWithTimeout (any (), any (), any ( ));
428421 doReturn (false ).when (bigQueryStatementSpy ).useReadAPI (eq (tableResult ));
429422 doReturn (mock (JobId .class )).when (tableResult ).getJobId ();
430423 Mockito .when (job .getQueryResults (any (QueryResultsOption .class )))
0 commit comments