@Test
public void shouldRunJob() {

    // given:
    String jobType = "bar";
    when(jobRunnable.getJobDefinition()).thenReturn(someJobDefinition(jobType));
    // when:
    Optional<String> optionalJobId = jobService.startAsyncJob(jobType);
    // then:
    final JobInfo expectedJobInfo = JobInfo.newJobInfo(optionalJobId.get(), jobType, clock, systemInfo.hostname);
    verify(executorService).execute(any(Runnable.class));
    verify(jobRepository).createOrUpdate(expectedJobInfo);
    verify(jobRunnable).execute(any(JobEventPublisher.class));
    verify(jobMetaService).aquireRunLock(expectedJobInfo.getJobId(), expectedJobInfo.getJobType());
}