@Override
    public boolean matches(Job localJob, Job storageProviderJob) {
        if (storageProviderJob.getVersion() > localJob.getVersion() + 1) {
            Optional<ProcessingState> localProcessingState = localJob.getLastJobStateOfType(ProcessingState.class);
            Optional<ProcessingState> storageProviderProcessingState = storageProviderJob.getLastJobStateOfType(ProcessingState.class);
            if (localProcessingState.isPresent() && storageProviderProcessingState.isPresent()) {
                return !localProcessingState.get().getServerId().equals(storageProviderProcessingState.get().getServerId());
            }
        }
        return false;
    }
@Test
    void ifJobIsHavingConcurrentStateChangeOnDifferentServerItWillMatch() {
        final Job jobInProgress = aJobInProgress()
                .withVersion(3)
                .build();
        final Job jobInProgressOnOtherServer = aCopyOf(jobInProgress)
                .withVersion(6)
                .withState(new FailedState("Orphaned job", new IllegalStateException("Not important")))
                .withState(new ScheduledState(Instant.now()))
                .withState(new EnqueuedState())
                .withState(new ProcessingState(UUID.randomUUID(), "Not important"))
                .build();

        boolean matchesAllowedStateChange = allowedStateChange.matches(jobInProgress, jobInProgressOnOtherServer);
        assertThat(matchesAllowedStateChange).isTrue();
    }