@SuppressWarnings("unchecked") @Test void testDeleteAllForbidden() { JobExecution jobExecution = mock(JobExecution.class); when(jobExecution.getStatus()).thenReturn(Status.PENDING).getMock(); doAnswer( invocation -> { ((Consumer<List<Entity>>) invocation.getArgument(1)) .accept(singletonList(jobExecution)); return null; }) .when(delegateRepository) .forEachBatched(any(), any(), eq(1000)); assertThrows( ActiveJobExecutionDeleteForbiddenException.class, () -> jobExecutionRepositoryDecorator.deleteAll()); }
@Override public void deleteAll() { forEachBatched( jobExecutionBatch -> jobExecutionBatch.forEach(this::validateDeleteAllowed), BATCH_SIZE); super.deleteAll(); }
JobExecutionRepositoryDecorator extends AbstractRepositoryDecorator<JobExecution> { @Override public void deleteAll() { forEachBatched( jobExecutionBatch -> jobExecutionBatch.forEach(this::validateDeleteAllowed), BATCH_SIZE); super.deleteAll(); } }
JobExecutionRepositoryDecorator extends AbstractRepositoryDecorator<JobExecution> { @Override public void deleteAll() { forEachBatched( jobExecutionBatch -> jobExecutionBatch.forEach(this::validateDeleteAllowed), BATCH_SIZE); super.deleteAll(); } JobExecutionRepositoryDecorator(Repository<JobExecution> delegateRepository); }
JobExecutionRepositoryDecorator extends AbstractRepositoryDecorator<JobExecution> { @Override public void deleteAll() { forEachBatched( jobExecutionBatch -> jobExecutionBatch.forEach(this::validateDeleteAllowed), BATCH_SIZE); super.deleteAll(); } JobExecutionRepositoryDecorator(Repository<JobExecution> delegateRepository); @Override void delete(JobExecution jobExecution); @Override void deleteById(Object id); @Override void deleteAll(); @Override void delete(Stream<JobExecution> jobExecutionStream); @Override void deleteAll(Stream<Object> ids); }
JobExecutionRepositoryDecorator extends AbstractRepositoryDecorator<JobExecution> { @Override public void deleteAll() { forEachBatched( jobExecutionBatch -> jobExecutionBatch.forEach(this::validateDeleteAllowed), BATCH_SIZE); super.deleteAll(); } JobExecutionRepositoryDecorator(Repository<JobExecution> delegateRepository); @Override void delete(JobExecution jobExecution); @Override void deleteById(Object id); @Override void deleteAll(); @Override void delete(Stream<JobExecution> jobExecutionStream); @Override void deleteAll(Stream<Object> ids);  }