JobDetail detail = mock(JobDetail.class);
when(detail.getKey()).thenReturn(jobKey("name", "group"));
when(detail.getJobDataMap()).thenReturn(map);
JobStatus status = new JobStatus(detail);
// store a merge so we can find it in the test run
curator.merge(status);
JobExecutionContext ctx = mock(JobExecutionContext.class);
when(ctx.getMergedJobDataMap()).thenReturn(map);
when(ctx.getJobDetail()).thenReturn(detail);
// thing to be tested
listener.jobWasExecuted(ctx, e);
// verify the message stored is a substring of the long message
JobStatus verify = curator.find("name");
assertEquals(longstr.substring(0, JobStatus.RESULT_COL_LENGTH),
verify.getResult());
}