### Question:
BatchJobManager { public boolean isEligibleForDeltaPurge(Exchange exchange) { WorkNote workNote = exchange.getIn().getBody(WorkNote.class); String jobId = workNote.getBatchJobId(); String deltaMode = batchJobDAO.getDuplicateDetectionMode(jobId); if(deltaMode != null && isDeltaPurgeMode(deltaMode)) { return true; } return false; }  void prepareTenantContext(Exchange exchange); boolean isDryRun(Exchange exchange); boolean hasErrors(Exchange exchange); boolean isEligibleForDeltaPurge(Exchange exchange);  }### Answer:
@Test public void testPurgeDisableDeltas() throws Exception { Mockito.when(batchJobDAO.getDuplicateDetectionMode(jobId)).thenReturn(RecordHash.RECORD_HASH_MODE_DISABLE); Exchange exchange = new DefaultExchange(new DefaultCamelContext()); WorkNote workNote = new WorkNote(jobId, false); exchange.getIn().setBody(workNote); boolean isEligible = batchJobManager.isEligibleForDeltaPurge(exchange); Assert.assertTrue(isEligible); }
@Test public void testPurgeResetDeltas() throws Exception { Mockito.when(batchJobDAO.getDuplicateDetectionMode(jobId)).thenReturn(RecordHash.RECORD_HASH_MODE_RESET); Exchange exchange = new DefaultExchange(new DefaultCamelContext()); WorkNote workNote = new WorkNote(jobId, false); exchange.getIn().setBody(workNote); boolean isEligible = batchJobManager.isEligibleForDeltaPurge(exchange); Assert.assertTrue(isEligible); }
@Test public void testNoPurgeDeltas() throws Exception { Mockito.when(batchJobDAO.getDuplicateDetectionMode(jobId)).thenReturn(null); Exchange exchange = new DefaultExchange(new DefaultCamelContext()); WorkNote workNote = new WorkNote(jobId, false); exchange.getIn().setBody(workNote); boolean isEligible = batchJobManager.isEligibleForDeltaPurge(exchange); Assert.assertFalse(isEligible); }