Exemplo n.º 1
0
  @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);
  }
Exemplo n.º 2
0
  @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);
  }