@SuppressWarnings("unchecked") @Disabled @Test void testDeleteStreamFails() { ScheduledJobType scheduledJobType = mock(ScheduledJobType.class); when(scheduledJobType.getSchema()).thenReturn(SCHEMA); when(scheduledJob.getParameters()).thenReturn(PARAMETERS); when(scheduledJob.getType()).thenReturn(scheduledJobType); doAnswer( (InvocationOnMock invocation) -> { Stream<ScheduledJob> jobStream = invocation.getArgument(0); jobStream.collect(Collectors.toList()); throw new MolgenisDataException("Failed"); }) .when(delegateRepository) .delete(any(Stream.class)); when(scheduledJob.getId()).thenReturn("id"); try { scheduledJobRepositoryDecorator.delete(Stream.of(scheduledJob)); fail("delete method should rethrow exception from delegate repository"); } catch (MolgenisDataException expected) { } verifyNoMoreInteractions(jobScheduler, "Jobs should not be unscheduled if deletion fails."); }
@Override public void delete(ScheduledJob scheduledJob) { String entityId = scheduledJob.getId(); delegate().delete(scheduledJob); scheduler.unschedule(entityId); }
ScheduledJobRepositoryDecorator extends AbstractRepositoryDecorator<ScheduledJob> { @Override public void delete(ScheduledJob scheduledJob) { String entityId = scheduledJob.getId(); delegate().delete(scheduledJob); scheduler.unschedule(entityId); } }
ScheduledJobRepositoryDecorator extends AbstractRepositoryDecorator<ScheduledJob> { @Override public void delete(ScheduledJob scheduledJob) { String entityId = scheduledJob.getId(); delegate().delete(scheduledJob); scheduler.unschedule(entityId); } ScheduledJobRepositoryDecorator(
      Repository<ScheduledJob> delegateRepository,
      JobScheduler scheduler,
      JsonValidator jsonValidator); }
ScheduledJobRepositoryDecorator extends AbstractRepositoryDecorator<ScheduledJob> { @Override public void delete(ScheduledJob scheduledJob) { String entityId = scheduledJob.getId(); delegate().delete(scheduledJob); scheduler.unschedule(entityId); } ScheduledJobRepositoryDecorator(
      Repository<ScheduledJob> delegateRepository,
      JobScheduler scheduler,
      JsonValidator jsonValidator); @Override void update(ScheduledJob scheduledJob); @Override void update(Stream<ScheduledJob> scheduledJobs); @Override void delete(ScheduledJob scheduledJob); @Override void delete(Stream<ScheduledJob> jobs); @Override void deleteById(Object id); @Override void deleteAll(Stream<Object> ids); @Override void deleteAll(); @Override void add(ScheduledJob scheduledJob); @Override Integer add(Stream<ScheduledJob> jobs); }
ScheduledJobRepositoryDecorator extends AbstractRepositoryDecorator<ScheduledJob> { @Override public void delete(ScheduledJob scheduledJob) { String entityId = scheduledJob.getId(); delegate().delete(scheduledJob); scheduler.unschedule(entityId); } ScheduledJobRepositoryDecorator(
      Repository<ScheduledJob> delegateRepository,
      JobScheduler scheduler,
      JsonValidator jsonValidator); @Override void update(ScheduledJob scheduledJob); @Override void update(Stream<ScheduledJob> scheduledJobs); @Override void delete(ScheduledJob scheduledJob); @Override void delete(Stream<ScheduledJob> jobs); @Override void deleteById(Object id); @Override void deleteAll(Stream<Object> ids); @Override void deleteAll(); @Override void add(ScheduledJob scheduledJob); @Override Integer add(Stream<ScheduledJob> jobs);  }