@Test
public void testTerminateTaskWithNoQuota() {

    Pair<Job, List<Task>> jobAndTask = createAndStartJobWithTasks(1);
    Job<?> job = jobAndTask.getLeft();
    Task task = jobAndTask.getRight().get(0);
    when(quotasManager.tryConsumeQuota(job, task)).thenReturn(ConsumptionResult.rejected("no quota"));
    StepVerifier
            .withVirtualTime(() -> newTerminationExecutor().terminateTask(task.getId(), EVICTION_REASON, "callerContext"))
            .consumeErrorWith(e -> expectEvictionError(e, ErrorCode.NoQuota))
            .verify();
    expectTaskTerminationEvent(task, false);
    verify(quotasManager, times(1)).tryConsumeQuota(job, task);
}