Search in sources :

Example 1 with JobExecutionException

use of org.molgenis.jobs.JobExecutionException in project molgenis by molgenis.

the class AnnotationJobTest method testFirstAnnotatorFails.

@Test
public void testFirstAnnotatorFails() throws IOException {
    when(exac.getSimpleName()).thenReturn("exac");
    when(cadd.getSimpleName()).thenReturn("cadd");
    AnnotationException exception = new AnnotationException(mock(AnnotationException.class));
    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);
}
Also used : JobExecutionException(org.molgenis.jobs.JobExecutionException) AnnotationException(org.molgenis.data.annotation.core.exception.AnnotationException) Test(org.testng.annotations.Test) AbstractMockitoTest(org.molgenis.test.AbstractMockitoTest)

Aggregations

AnnotationException (org.molgenis.data.annotation.core.exception.AnnotationException)1 JobExecutionException (org.molgenis.jobs.JobExecutionException)1 AbstractMockitoTest (org.molgenis.test.AbstractMockitoTest)1 Test (org.testng.annotations.Test)1