Search in sources :

Example 1 with CoverageVerificationException

use of gov.cms.ab2d.worker.processor.coverage.CoverageVerificationException in project ab2d by CMSgov.

the class CoverageCheckQuartzJobTest method whenVerificationException_alertWithIssues.

@DisplayName("Report issues when verification detects issues")
@Test
void whenVerificationException_alertWithIssues() {
    when(propertiesService.isInMaintenanceMode()).thenReturn(false);
    doThrow(new CoverageVerificationException("testing123", List.of("alertalert"))).when(coverageDriver).verifyCoverage();
    CoverageCheckQuartzJob job = new CoverageCheckQuartzJob(logManager, coverageDriver, propertiesService);
    JobExecutionException exception = assertThrows(JobExecutionException.class, () -> job.executeInternal(null));
    assertTrue(exception.getMessage().contains("testing123"));
    verify(propertiesService, times(1)).isInMaintenanceMode();
    verify(coverageDriver, times(1)).verifyCoverage();
    verify(logManager, times(1)).alert(argThat(alert -> alert.contains("alertalert") && alert.contains("Coverage verification failed")), anyList());
}
Also used : MockitoExtension(org.mockito.junit.jupiter.MockitoExtension) LogManager(gov.cms.ab2d.eventlogger.LogManager) CoverageDriver(gov.cms.ab2d.worker.processor.coverage.CoverageDriver) Mock(org.mockito.Mock) CoverageVerificationException(gov.cms.ab2d.worker.processor.coverage.CoverageVerificationException) DisplayName(org.junit.jupiter.api.DisplayName) Test(org.junit.jupiter.api.Test) JobExecutionException(org.quartz.JobExecutionException) Mockito(org.mockito.Mockito) AfterEach(org.junit.jupiter.api.AfterEach) List(java.util.List) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) PropertiesService(gov.cms.ab2d.common.service.PropertiesService) Assertions(org.junit.jupiter.api.Assertions) JobExecutionException(org.quartz.JobExecutionException) CoverageVerificationException(gov.cms.ab2d.worker.processor.coverage.CoverageVerificationException) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

PropertiesService (gov.cms.ab2d.common.service.PropertiesService)1 LogManager (gov.cms.ab2d.eventlogger.LogManager)1 CoverageDriver (gov.cms.ab2d.worker.processor.coverage.CoverageDriver)1 CoverageVerificationException (gov.cms.ab2d.worker.processor.coverage.CoverageVerificationException)1 List (java.util.List)1 AfterEach (org.junit.jupiter.api.AfterEach)1 Assertions (org.junit.jupiter.api.Assertions)1 DisplayName (org.junit.jupiter.api.DisplayName)1 Test (org.junit.jupiter.api.Test)1 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)1 Mock (org.mockito.Mock)1 Mockito (org.mockito.Mockito)1 MockitoExtension (org.mockito.junit.jupiter.MockitoExtension)1 JobExecutionException (org.quartz.JobExecutionException)1