@Test
public void testConsume() {

    Job<BatchJobExt> job = newBatchJob(10, budget(percentageOfHealthyPolicy(80.0), hourlyRatePercentage(20), Collections.emptyList()));
    com.netflix.titus.api.model.reference.Reference jobReference = com.netflix.titus.api.model.reference.Reference.job(job.getId());
    scheduleJob(job, 10);
    JobQuotaController jobController = new JobQuotaController(job, jobOperations, SelfJobDisruptionBudgetResolver.getInstance(), containerHealthService, titusRuntime);
    assertThat(jobController.getQuota(jobReference).getQuota()).isEqualTo(2);
    Task task = jobOperations.getTasks(job.getId()).get(0);
    assertThat(jobController.consume(task.getId()).isApproved()).isTrue();
    assertThat(jobController.consume(task.getId()).isApproved()).isTrue();
    assertThat(jobController.getQuota(jobReference).getQuota()).isEqualTo(0);
    ConsumptionResult failure = jobController.consume(task.getId());
    assertThat(failure.isApproved()).isFalse();
    assertThat(failure.getRejectionReason().get()).contains("JobPercentagePerHourRelocationRateController");
}