@@ -1324,12 +1324,8 @@ public void testCheckStatementAlive_succeededState_returnsTrue() throws Exceptio
13241324 new DatabricksSdkClient (connectionContext , statementExecutionService , apiClient );
13251325
13261326 StatementStatus status = new StatementStatus ().setState (StatementState .SUCCEEDED );
1327- GetStatementResponse response = new GetStatementResponse ();
1328- response .setStatus (status );
1329- response .setStatementId (STATEMENT_ID .toSQLExecStatementId ());
13301327
1331- when (apiClient .execute (any (Request .class ), eq (GetStatementResponse .class )))
1332- .thenReturn (response );
1328+ when (apiClient .execute (any (Request .class ), eq (StatementStatus .class ))).thenReturn (status );
13331329
13341330 assertTrue (databricksSdkClient .checkStatementAlive (STATEMENT_ID ));
13351331 }
@@ -1342,11 +1338,8 @@ public void testCheckStatementAlive_runningState_returnsTrue() throws Exception
13421338 new DatabricksSdkClient (connectionContext , statementExecutionService , apiClient );
13431339
13441340 StatementStatus status = new StatementStatus ().setState (StatementState .RUNNING );
1345- GetStatementResponse response = new GetStatementResponse ();
1346- response .setStatus (status );
13471341
1348- when (apiClient .execute (any (Request .class ), eq (GetStatementResponse .class )))
1349- .thenReturn (response );
1342+ when (apiClient .execute (any (Request .class ), eq (StatementStatus .class ))).thenReturn (status );
13501343
13511344 assertTrue (databricksSdkClient .checkStatementAlive (STATEMENT_ID ));
13521345 }
@@ -1359,11 +1352,8 @@ public void testCheckStatementAlive_canceledState_returnsFalse() throws Exceptio
13591352 new DatabricksSdkClient (connectionContext , statementExecutionService , apiClient );
13601353
13611354 StatementStatus status = new StatementStatus ().setState (StatementState .CANCELED );
1362- GetStatementResponse response = new GetStatementResponse ();
1363- response .setStatus (status );
13641355
1365- when (apiClient .execute (any (Request .class ), eq (GetStatementResponse .class )))
1366- .thenReturn (response );
1356+ when (apiClient .execute (any (Request .class ), eq (StatementStatus .class ))).thenReturn (status );
13671357
13681358 assertFalse (databricksSdkClient .checkStatementAlive (STATEMENT_ID ));
13691359 }
@@ -1376,11 +1366,8 @@ public void testCheckStatementAlive_closedState_returnsFalse() throws Exception
13761366 new DatabricksSdkClient (connectionContext , statementExecutionService , apiClient );
13771367
13781368 StatementStatus status = new StatementStatus ().setState (StatementState .CLOSED );
1379- GetStatementResponse response = new GetStatementResponse ();
1380- response .setStatus (status );
13811369
1382- when (apiClient .execute (any (Request .class ), eq (GetStatementResponse .class )))
1383- .thenReturn (response );
1370+ when (apiClient .execute (any (Request .class ), eq (StatementStatus .class ))).thenReturn (status );
13841371
13851372 assertFalse (databricksSdkClient .checkStatementAlive (STATEMENT_ID ));
13861373 }
@@ -1393,11 +1380,8 @@ public void testCheckStatementAlive_failedState_returnsFalse() throws Exception
13931380 new DatabricksSdkClient (connectionContext , statementExecutionService , apiClient );
13941381
13951382 StatementStatus status = new StatementStatus ().setState (StatementState .FAILED );
1396- GetStatementResponse response = new GetStatementResponse ();
1397- response .setStatus (status );
13981383
1399- when (apiClient .execute (any (Request .class ), eq (GetStatementResponse .class )))
1400- .thenReturn (response );
1384+ when (apiClient .execute (any (Request .class ), eq (StatementStatus .class ))).thenReturn (status );
14011385
14021386 assertFalse (databricksSdkClient .checkStatementAlive (STATEMENT_ID ));
14031387 }
@@ -1409,7 +1393,7 @@ public void testCheckStatementAlive_exceptionWrapped() throws Exception {
14091393 DatabricksSdkClient databricksSdkClient =
14101394 new DatabricksSdkClient (connectionContext , statementExecutionService , apiClient );
14111395
1412- when (apiClient .execute (any (Request .class ), eq (GetStatementResponse .class )))
1396+ when (apiClient .execute (any (Request .class ), eq (StatementStatus .class )))
14131397 .thenThrow (new RuntimeException ("Network error" ));
14141398
14151399 DatabricksSQLException exception =
0 commit comments