use of org.candlepin.sync.ConflictOverrides in project candlepin by candlepin.
the class ImportJobTest method ensureJobFailure.
@Test
public void ensureJobFailure() throws Exception {
String archiveFilePath = "/path/to/some/file.zip";
ConflictOverrides co = new ConflictOverrides();
String uploadedFileName = "test.zip";
String expectedMessage = "Expected Exception Message";
JobDetail detail = job.scheduleImport(owner, archiveFilePath, uploadedFileName, co);
when(ctx.getMergedJobDataMap()).thenReturn(detail.getJobDataMap());
when(ownerCurator.lookupByKey(eq(owner.getKey()))).thenReturn(owner);
when(manifestManager.importStoredManifest(eq(owner), any(String.class), any(ConflictOverrides.class), eq(uploadedFileName))).thenThrow(new ImporterException(expectedMessage));
try {
job.execute(ctx);
fail("Expected exception to be thrown");
} catch (JobExecutionException e) {
// Expected
}
verify(ctx).setResult(eq(expectedMessage));
}
Aggregations