@Override
    public boolean matches(Job localJob, Job storageProviderJob) {
        return AllowedConcurrentStateChange.super.matches(localJob, storageProviderJob)
                && localJob.getVersion() == storageProviderJob.getVersion() - 1
                && localJob.getLastJobStateOfType(FailedState.class).isPresent();
    }
@Test
    void ifStorageJobHasOtherThanScheduledStateItWillNotMatch() {
        final Job enqueuedJob = anEnqueuedJob().build();
        final Job succeededJob = aCopyOf(enqueuedJob).withState(new SucceededState(ofMillis(10), ofMillis(6))).build();

        boolean matchesAllowedStateChange = allowedStateChange.matches(enqueuedJob, succeededJob);
        assertThat(matchesAllowedStateChange).isFalse();
    }