@Override
    public void resolve(ConcurrentJobModificationException e) {
        final List<Job> concurrentUpdatedJobs = e.getConcurrentUpdatedJobs();
        final List<ConcurrentJobModificationResolveResult> failedToResolve = concurrentUpdatedJobs
                .stream()
                .map(this::resolve)
                .filter(ConcurrentJobModificationResolveResult::failed)
                .collect(toList());

        if (!failedToResolve.isEmpty()) {
            throw new UnresolvableConcurrentJobModificationException(failedToResolve, e);
        }
    }
@Test
    void concurrentStateChangeFromUnsupportedStateChangeIsNotAllowedAndThrowsException() {
        final Job job1 = aJobInProgress().build();
        final Job job2 = aJobInProgress().build();

        when(storageProvider.getJobById(job1.getId())).thenReturn(aCopyOf(job1).build());
        when(storageProvider.getJobById(job2.getId())).thenReturn(aCopyOf(job2).build());

        assertThatThrownBy(() -> concurrentJobModificationResolver.resolve(new ConcurrentJobModificationException(asList(job1, job2))))
                .isInstanceOf(ConcurrentJobModificationException.class)
                .has(failedJob(job1))
                .has(failedJob(job2));
    }