@Test public void testExecute() throws Exception { JobStatus jobStatus = jobExecutor.getJobStatus(); assertFalse(jobStatus.isRunning()); assertTrue(jobExecutor.execute(context)); verify(job).execute(); assertEquals(jobStatus.getJobStatusType(), JobStatusType.FINISHED); }
@Test public void testExecuteFailure() throws Exception { MigratorException failure = new MigratorException("Failure"); willThrow(failure).given(job).execute(); JobStatus jobStatus = jobExecutor.getJobStatus(); assertFalse(jobStatus.isRunning()); assertTrue(jobExecutor.execute(context)); verify(job).execute(); assertEquals(failure, jobStatus.getFailure()); assertEquals(jobStatus.getJobStatusType(), JobStatusType.FINISHED); }