@Test
public void testRetrieveJobs() {

    Session session = cassandraCqlUnit.getSession();
    JobStore bootstrappingStore = getJobStore(session);
    Job<BatchJobExt> job = createBatchJobObject();
    bootstrappingStore.storeJob(job).await();
    JobStore store = getJobStore(session);
    store.init().await();
    Pair<List<Job<?>>, Integer> jobsAndErrors = store.retrieveJobs().toBlocking().first();
    assertThat(jobsAndErrors.getLeft()).hasSize(1);
    assertThat(jobsAndErrors.getRight()).isEqualTo(0);
    assertThat(jobsAndErrors.getLeft().get(0)).isEqualTo(job);
    // Check that archive access does not return anything.
    try {
        store.retrieveArchivedJob(job.getId()).toBlocking().first();
        fail("Should not return active job");
    } catch (JobStoreException e) {
        assertThat(e.getErrorCode()).isEqualTo(JobStoreException.ErrorCode.JOB_DOES_NOT_EXIST);
    }
}