### Question:
DistributedBatchQueue extends JobQueueCommon { @Override public void assertHealthy(UUID aggregatorID) { try (final Session session = this.factory.openSession()) { try { OffsetDateTime stuckSince = OffsetDateTime.now(ZoneId.systemDefault()).minusMinutes(3); logger.debug(String.format("Checking aggregatorID(%s) for stuck jobs since (%s)...", aggregatorID, stuckSince.toString())); Long stuckBatchCount = (Long) session .createQuery("select count(*) from job_queue_batch where aggregatorID = :aggregatorID and status = 1 and updateTime < :updateTime") .setParameter("aggregatorID", aggregatorID) .setParameter("updateTime", stuckSince) .uniqueResult(); logger.debug(String.format("Found (%d) stuck jobs on aggregatorID(%s).", stuckBatchCount, aggregatorID)); if (stuckBatchCount > 0) { throw new JobQueueUnhealthy(JOB_UNHEALTHY); } } catch (JobQueueUnhealthy e) { throw e; } catch (Exception e) { throw new JobQueueUnhealthy(DB_UNHEALTHY, e); } } } @Inject  DistributedBatchQueue(
            DPCQueueManagedSessionFactory factory,
            @QueueBatchSize int batchSize,
            MetricRegistry metricRegistry
    ); @Override void submitJobBatches(List<JobQueueBatch> jobBatches); @Override Optional<JobQueueBatch> getBatch( UUID batchID); @Override List<JobQueueBatch> getJobBatches(UUID jobID); @SuppressWarnings({"unchecked", "rawtypes"}) @Override Optional<JobQueueBatchFile> getJobBatchFile(UUID organizationID, String fileID); @Override Optional<JobQueueBatch> claimBatch(UUID aggregatorID); @Override void pauseBatch(JobQueueBatch job, UUID aggregatorID); @Override void completePartialBatch(JobQueueBatch job, UUID aggregatorID); @Override void completeBatch(JobQueueBatch job, UUID aggregatorID); @Override void failBatch(JobQueueBatch job, UUID aggregatorID); @Override long queueSize(); @Override String queueType(); @Override void assertHealthy(UUID aggregatorID);  }### Answer:
@Test void validateHealthyQueue() { queue.assertHealthy(aggregatorID); }
@Test void validateUnhealthyQueueDueToJobFailure() { final UUID orgID = UUID.randomUUID(); this.buildStuckBatchScenario(orgID); try { queue.assertHealthy(aggregatorID); Assert.fail("Expected JobQueueUnhealthy exception not throw"); } catch (JobQueueUnhealthy e) { assertEquals("Aggregator is not making progress on the queue", e.getMessage()); } }