|
20 | 20 | import static com.datastax.dse.driver.internal.core.graph.GraphTestUtils.tenGraphRows; |
21 | 21 | import static com.datastax.oss.driver.Assertions.assertThat; |
22 | 22 | import static com.datastax.oss.driver.Assertions.assertThatStage; |
| 23 | +import static org.assertj.core.api.Assertions.assertThatThrownBy; |
23 | 24 | import static org.mockito.ArgumentMatchers.anyLong; |
24 | 25 | import static org.mockito.ArgumentMatchers.eq; |
25 | 26 | import static org.mockito.Mockito.times; |
@@ -182,9 +183,10 @@ public void should_honor_default_timeout() throws Exception { |
182 | 183 |
|
183 | 184 | // will trigger the global timeout and complete it exceptionally |
184 | 185 | globalTimeout.task().run(globalTimeout); |
185 | | - assertThat(page1Future.toCompletableFuture()) |
186 | | - .hasFailedWithThrowableThat() |
187 | | - .isInstanceOf(DriverTimeoutException.class) |
| 186 | + assertThat(page1Future.toCompletableFuture()).isCompletedExceptionally(); |
| 187 | + |
| 188 | + assertThatThrownBy(() -> page1Future.toCompletableFuture().get()) |
| 189 | + .hasRootCauseExactlyInstanceOf(DriverTimeoutException.class) |
188 | 190 | .hasMessageContaining("Query timed out after " + defaultTimeout); |
189 | 191 | } |
190 | 192 | } |
@@ -233,9 +235,10 @@ public void should_honor_statement_timeout() throws Exception { |
233 | 235 |
|
234 | 236 | // will trigger the global timeout and complete it exceptionally |
235 | 237 | globalTimeout.task().run(globalTimeout); |
236 | | - assertThat(page1Future.toCompletableFuture()) |
237 | | - .hasFailedWithThrowableThat() |
238 | | - .isInstanceOf(DriverTimeoutException.class) |
| 238 | + assertThat(page1Future.toCompletableFuture()).isCompletedExceptionally(); |
| 239 | + |
| 240 | + assertThatThrownBy(() -> page1Future.toCompletableFuture().get()) |
| 241 | + .hasRootCauseExactlyInstanceOf(DriverTimeoutException.class) |
239 | 242 | .hasMessageContaining("Query timed out after " + statementTimeout); |
240 | 243 | } |
241 | 244 | } |
|
0 commit comments