Search in sources :

Example 6 with ContractToContractCoverageMapping

use of gov.cms.ab2d.worker.config.ContractToContractCoverageMapping in project ab2d by CMSgov.

the class CoverageMappingCallableTest method callableFunctions.

@DisplayName("Successfully completing marks as done and transfers results")
@Test
void callableFunctions() {
    org.hl7.fhir.dstu3.model.Bundle bundle1 = buildBundle(0, 10, 2020);
    bundle1.setLink(singletonList(new org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent().setRelation(org.hl7.fhir.dstu3.model.Bundle.LINK_NEXT)));
    org.hl7.fhir.dstu3.model.Bundle bundle2 = buildBundle(10, 20, 2020);
    when(bfdClient.requestPartDEnrolleesFromServer(eq(STU3), anyString(), anyInt(), anyInt())).thenReturn(bundle1);
    when(bfdClient.requestNextBundleFromServer(eq(STU3), any(org.hl7.fhir.dstu3.model.Bundle.class))).thenReturn(bundle2);
    ContractDTO contract = new ContractDTO("TESTING", "TESTING", null, null);
    CoveragePeriod period = new CoveragePeriod();
    period.setContractNumber(contract.getContractNumber());
    period.setYear(2020);
    period.setMonth(1);
    CoverageSearchEvent cse = new CoverageSearchEvent();
    cse.setCoveragePeriod(period);
    CoverageSearch search = new CoverageSearch();
    search.setPeriod(period);
    ContractToContractCoverageMapping contractToContractCoverageMapping = new ContractToContractCoverageMapping();
    CoverageMapping mapping = new CoverageMapping(cse, search);
    CoverageMappingCallable callable = new CoverageMappingCallable(STU3, mapping, bfdClient, mapping.getPeriod().getYear());
    assertFalse(callable.isCompleted());
    CoverageMapping results = callable.call();
    assertEquals(mapping, results);
    assertTrue(callable.isCompleted());
    assertTrue(mapping.isSuccessful());
    assertEquals(20, results.getBeneficiaryIds().size());
}
Also used : ContractToContractCoverageMapping(gov.cms.ab2d.worker.config.ContractToContractCoverageMapping) CoverageMapping(gov.cms.ab2d.coverage.model.CoverageMapping) ContractDTO(gov.cms.ab2d.common.dto.ContractDTO) CoveragePeriod(gov.cms.ab2d.coverage.model.CoveragePeriod) CoverageSearch(gov.cms.ab2d.coverage.model.CoverageSearch) ContractToContractCoverageMapping(gov.cms.ab2d.worker.config.ContractToContractCoverageMapping) CoverageSearchEvent(gov.cms.ab2d.coverage.model.CoverageSearchEvent) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

ContractToContractCoverageMapping (gov.cms.ab2d.worker.config.ContractToContractCoverageMapping)6 ContractDTO (gov.cms.ab2d.common.dto.ContractDTO)2 PdpClient (gov.cms.ab2d.common.model.PdpClient)2 ContractForCoverageDTO (gov.cms.ab2d.coverage.model.ContractForCoverageDTO)2 CoverageMapping (gov.cms.ab2d.coverage.model.CoverageMapping)2 CoveragePeriod (gov.cms.ab2d.coverage.model.CoveragePeriod)2 CoverageSearch (gov.cms.ab2d.coverage.model.CoverageSearch)2 CoverageSearchEvent (gov.cms.ab2d.coverage.model.CoverageSearchEvent)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 DisplayName (org.junit.jupiter.api.DisplayName)2 Test (org.junit.jupiter.api.Test)2 ThreadPoolTaskExecutor (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor)2 BFDClient (gov.cms.ab2d.bfd.client.BFDClient)1 PdpClientDTO (gov.cms.ab2d.common.dto.PdpClientDTO)1 Job (gov.cms.ab2d.common.model.Job)1 CoverageCount (gov.cms.ab2d.coverage.model.CoverageCount)1 SearchConfig (gov.cms.ab2d.worker.config.SearchConfig)1 PatientClaimsProcessorStub (gov.cms.ab2d.worker.processor.stub.PatientClaimsProcessorStub)1 StubJobRepository (gov.cms.ab2d.worker.repository.StubJobRepository)1 ContractWorkerClient (gov.cms.ab2d.worker.service.ContractWorkerClient)1