@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 ifJobHasEnqueuedStateAndWasScheduledTooEarlyByJobZooKeeperItWillMatch() {
        final Job scheduledJob = aJob()
                .withFailedState()
                .withScheduledState()
                .withVersion(5)
                .build();
        final Job enqueuedJob = aCopyOf(scheduledJob)
                .withEnqueuedState(Instant.now())
                .withVersion(4)
                .build();

        boolean matchesAllowedStateChange = allowedStateChange.matches(enqueuedJob, scheduledJob);
        assertThat(matchesAllowedStateChange).isTrue();
    }