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());
}
Aggregations