@Test
public void testTableExistsUnhandledException() throws IOException {

  IOException fakeUnhandledException = new IOException("Fake unhandled exception");
  when(mockBigqueryTablesGet.execute()).thenThrow(fakeUnhandledException);
  when(mockErrorExtractor.itemNotFound(any(IOException.class))).thenReturn(false);
  IOException thrown = assertThrows(IOException.class, () -> helper.tableExists(tableRef));
  assertThat(thrown).hasCauseThat().isEqualTo(fakeUnhandledException);
  // Verify correct calls are made.
  verify(mockBigquery, times(1)).tables();
  verify(mockBigqueryTables, times(1)).get(eq(projectId), eq(datasetId), eq(tableId));
  verify(mockBigqueryTablesGet, times(1)).execute();
  verify(mockErrorExtractor, times(1)).itemNotFound(eq(fakeUnhandledException));
}