예제 #1
0
  @Test
  public void testHappyPath() throws IOException {
    when(exac.getSimpleName()).thenReturn("exac");
    when(cadd.getSimpleName()).thenReturn("cadd");

    annotationJob.call();

    Mockito.verify(crudRepositoryAnnotator).annotate(exac, repository);
    Mockito.verify(crudRepositoryAnnotator).annotate(cadd, repository);

    Mockito.verify(progress).start();
    Mockito.verify(progress).setProgressMax(2);
    Mockito.verify(progress)
        .progress(0, "Annotating \"My repo\" with exac (annotator 1 of 2, started by \"fdlk\")");
    Mockito.verify(progress)
        .progress(1, "Annotating \"My repo\" with cadd (annotator 2 of 2, started by \"fdlk\")");
    Mockito.verify(progress).success();
  }
예제 #2
0
  @Test
  public void testFirstAnnotatorFails() throws IOException {
    when(exac.getSimpleName()).thenReturn("exac");
    when(cadd.getSimpleName()).thenReturn("cadd");

    IOException exception = new IOException("error");
    doThrow(exception).when(crudRepositoryAnnotator).annotate(exac, repository);
    try {
      annotationJob.call();
      fail("Should throw exception");
    } catch (JobExecutionException actual) {
      assertEquals(actual.getCause(), exception);
    }

    Mockito.verify(progress).start();
    Mockito.verify(progress).setProgressMax(2);
    Mockito.verify(progress)
        .progress(0, "Annotating \"My repo\" with exac (annotator 1 of 2, started by \"fdlk\")");
    Mockito.verify(progress)
        .progress(1, "Annotating \"My repo\" with cadd (annotator 2 of 2, started by \"fdlk\")");
    Mockito.verify(progress).status("Failed annotators: exac. Successful annotators: cadd");
    Mockito.verify(progress).failed(exception);
  }