@Test
  public void monitorQueryThreadExpirationTaskScheduled() {
    final ExecutionContext executionContext = mock(ExecutionContext.class);

    monitor.monitorQueryExecution(executionContext);
    Mockito.verify(scheduledThreadPoolExecutor, times(1)).schedule(captor.capture(), anyLong(),
        isA(TimeUnit.class));
    captor.getValue().run();

    Mockito.verify(executionContext, times(1))
        .setQueryCanceledException(isA(QueryExecutionTimeoutException.class));
    assertThatThrownBy(QueryMonitor::throwExceptionIfQueryOnCurrentThreadIsCanceled)
        .isExactlyInstanceOf(QueryExecutionCanceledException.class);
  }
although max_execution_time is set as 10ms, the monitor thread can sleep more than the specified
time, so query will be cancelled at un-deterministic time after 10ms. We cannot assert on
specific time at which the query will be cancelled. We can only assert that the query will be
cancelled at one point after 10ms.
geode-core/src/test/java/org/apache/geode/cache/query/internal/QueryMonitorTest.java