Skip to content

Commit 88c29a8

Browse files
committed
fix unit test where null is returned in mocks causing errors
1 parent d05ad30 commit 88c29a8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/BigQueryImplTest.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,6 @@ public void testGetModelNotFoundWhenThrowIsEnabled() throws IOException {
926926
String expected = "Model not found";
927927
when(bigqueryRpcMock.getModelSkipExceptionTranslation(
928928
PROJECT, DATASET, MODEL, EMPTY_RPC_OPTIONS))
929-
.thenReturn(null)
930929
.thenThrow(new BigQueryException(404, expected));
931930
options.setThrowNotFound(true);
932931
bigquery = options.getService();
@@ -1782,6 +1781,12 @@ public void testCreateJobWithBigQueryRetryConfigFailureShouldNotRetry() throws I
17821781
jobCapture.capture(), eq(bigQueryRpcOptions)))
17831782
.thenThrow(new BigQueryException(400, RATE_LIMIT_ERROR_MSG));
17841783

1784+
// Job create will attempt to retrieve the job even in the case when the job is created in a
1785+
// returned failure.
1786+
when(bigqueryRpcMock.getJobSkipExceptionTranslation(
1787+
nullable(String.class), nullable(String.class), nullable(String.class), Mockito.any()))
1788+
.thenThrow(new BigQueryException(500, "InternalError"));
1789+
17851790
bigquery = options.getService();
17861791
bigquery =
17871792
options
@@ -1839,7 +1844,7 @@ public void testCreateJobWithRetryOptionsFailureShouldNotRetry() throws IOExcept
18391844
.thenThrow(new BigQueryException(500, "InternalError"))
18401845
.thenReturn(newJobPb());
18411846

1842-
// Job create will attempt to retrieve the job even in the case when the job is created a
1847+
// Job create will attempt to retrieve the job even in the case when the job is created in a
18431848
// returned failure.
18441849
when(bigqueryRpcMock.getJobSkipExceptionTranslation(
18451850
nullable(String.class), nullable(String.class), nullable(String.class), Mockito.any()))

0 commit comments

Comments
 (0)