Search in sources :

Example 26 with CoverageSummary

use of gov.cms.ab2d.coverage.model.CoverageSummary in project ab2d by CMSgov.

the class JobProcessorIntegrationTest method andThenAnswerPatients.

private static OngoingStubbing<CoveragePagingResult> andThenAnswerPatients(CoverageDriver coverageDriver, ContractForCoverageDTO contract, int pageSize, int total) {
    OngoingStubbing<CoveragePagingResult> stubbing = when(coverageDriver.pageCoverage(any(CoveragePagingRequest.class)));
    List<CoverageSummary> fauxBeneficiaries = loadFauxMetadata(contract, total);
    for (int id = 0; id <= total - pageSize; id += pageSize) {
        stubbing = stubbing.thenReturn(new CoveragePagingResult(fauxBeneficiaries.subList(id, id + pageSize), new CoveragePagingRequest(pageSize, (long) id + pageSize, contract, OffsetDateTime.now())));
    }
    return stubbing.thenReturn(new CoveragePagingResult(fauxBeneficiaries.subList(total - pageSize, total), null));
}
Also used : CoveragePagingRequest(gov.cms.ab2d.coverage.model.CoveragePagingRequest) CoveragePagingResult(gov.cms.ab2d.coverage.model.CoveragePagingResult) CoverageSummary(gov.cms.ab2d.coverage.model.CoverageSummary)

Example 27 with CoverageSummary

use of gov.cms.ab2d.coverage.model.CoverageSummary in project ab2d by CMSgov.

the class PatientClaimsCollectorTest method testAfterSinceDate.

@DisplayName("Test to make sure that the EOB last updated is after since date")
@Test
void testAfterSinceDate() {
    ExplanationOfBenefit eob = new ExplanationOfBenefit();
    OffsetDateTime now = OffsetDateTime.now();
    OffsetDateTime oneMinuteLater = now.plusMinutes(1);
    OffsetDateTime oneMinuteEarlier = now.minusMinutes(1);
    eob.getMeta().setLastUpdated(new Date());
    CoverageSummary coverageSummary = new CoverageSummary(createIdentifierWithoutMbi(PATIENT_ID), null, List.of());
    PatientClaimsRequest request1 = new PatientClaimsRequest(List.of(coverageSummary), LATER_ATT_DATE, null, "client", "job", "contractNum", Contract.ContractType.CLASSIC_TEST, noOpToken, STU3, null);
    PatientClaimsCollector collector1 = new PatientClaimsCollector(request1, EPOCH);
    assertTrue(collector1.afterSinceDate(eob));
    PatientClaimsRequest request2 = new PatientClaimsRequest(List.of(coverageSummary), LATER_ATT_DATE, oneMinuteEarlier, "client", "job", "contractNum", Contract.ContractType.CLASSIC_TEST, noOpToken, STU3, null);
    PatientClaimsCollector collector2 = new PatientClaimsCollector(request2, EPOCH);
    assertTrue(collector2.afterSinceDate(eob));
    PatientClaimsRequest request3 = new PatientClaimsRequest(List.of(coverageSummary), LATER_ATT_DATE, oneMinuteLater, "client", "job", "contractNum", Contract.ContractType.CLASSIC_TEST, noOpToken, STU3, null);
    PatientClaimsCollector collector3 = new PatientClaimsCollector(request3, EPOCH);
    assertFalse(collector3.afterSinceDate(eob));
}
Also used : CoverageSummary(gov.cms.ab2d.coverage.model.CoverageSummary) OffsetDateTime(java.time.OffsetDateTime) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) Date(java.util.Date) FilterOutByDate(gov.cms.ab2d.filter.FilterOutByDate) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 28 with CoverageSummary

use of gov.cms.ab2d.coverage.model.CoverageSummary in project ab2d by CMSgov.

the class PatientClaimsCollectorTest method whenBundleEntriesNull_thenFailQuietly.

@DisplayName("Fail quietly on null bundle entries")
@Test
void whenBundleEntriesNull_thenFailQuietly() {
    try {
        CoverageSummary coverageSummary = new CoverageSummary(createIdentifierWithoutMbi(PATIENT_ID), null, List.of(TestUtil.getOpenRange()));
        ExplanationOfBenefit eob = (ExplanationOfBenefit) EobTestDataUtil.createEOB();
        eob.getBillablePeriod().setStart(SDF.parse("01/02/2020"));
        eob.getBillablePeriod().setEnd(SDF.parse("01/03/2020"));
        IBaseBundle oldBundle = EobTestDataUtil.createBundle(eob);
        ReflectionTestUtils.setField(oldBundle, "entry", null);
        PatientClaimsRequest request = new PatientClaimsRequest(List.of(coverageSummary), OffsetDateTime.now(), null, "client", "job", "contractNum", Contract.ContractType.NORMAL, noOpToken, STU3, null);
        PatientClaimsCollector collector = new PatientClaimsCollector(request, EPOCH);
        collector.filterAndAddEntries(oldBundle, coverageSummary);
        assertTrue(collector.getEobs().isEmpty());
    } catch (ParseException pe) {
        fail("could not parse bundle", pe);
    }
}
Also used : CoverageSummary(gov.cms.ab2d.coverage.model.CoverageSummary) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) ParseException(java.text.ParseException) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 29 with CoverageSummary

use of gov.cms.ab2d.coverage.model.CoverageSummary in project ab2d by CMSgov.

the class PatientClaimsCollectorTest method patientIdMustMatchRequest.

@DisplayName("Patient id in eob must match request")
@Test
void patientIdMustMatchRequest() {
    CoverageSummary coverageSummary = new CoverageSummary(createIdentifierWithoutMbi(1234L), null, List.of(TestUtil.getOpenRange()));
    PatientClaimsRequest request = new PatientClaimsRequest(List.of(coverageSummary), LATER_ATT_DATE, null, "client", "job", "contractNum", Contract.ContractType.NORMAL, noOpToken, STU3, null);
    PatientClaimsCollector collector = new PatientClaimsCollector(request, EPOCH);
    collector.filterAndAddEntries(BUNDLE, coverageSummary);
    assertTrue(collector.getEobs().isEmpty());
    coverageSummary = new CoverageSummary(createIdentifierWithoutMbi(PATIENT_ID), null, List.of(TestUtil.getOpenRange()));
    request = new PatientClaimsRequest(List.of(coverageSummary), LATER_ATT_DATE, null, "client", "job", "contractNum", Contract.ContractType.NORMAL, noOpToken, STU3, null);
    collector = new PatientClaimsCollector(request, EPOCH);
    collector.filterAndAddEntries(BUNDLE, coverageSummary);
    assertEquals(1, collector.getEobs().size());
}
Also used : CoverageSummary(gov.cms.ab2d.coverage.model.CoverageSummary) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 30 with CoverageSummary

use of gov.cms.ab2d.coverage.model.CoverageSummary in project ab2d by CMSgov.

the class PatientClaimsCollectorTest method normalBehavior.

@DisplayName("Happy path when EOB meets all requirements")
@Test
void normalBehavior() {
    CoverageSummary coverageSummary = new CoverageSummary(createIdentifierWithoutMbi(PATIENT_ID), null, List.of(TestUtil.getOpenRange()));
    PatientClaimsRequest request = new PatientClaimsRequest(List.of(coverageSummary), EARLY_ATT_DATE, null, "client", "job", "contractNum", Contract.ContractType.NORMAL, noOpToken, STU3, null);
    PatientClaimsCollector collector = new PatientClaimsCollector(request, EPOCH);
    collector.filterAndAddEntries(BUNDLE, coverageSummary);
    assertEquals(1, collector.getEobs().size());
}
Also used : CoverageSummary(gov.cms.ab2d.coverage.model.CoverageSummary) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

CoverageSummary (gov.cms.ab2d.coverage.model.CoverageSummary)35 Test (org.junit.jupiter.api.Test)27 DisplayName (org.junit.jupiter.api.DisplayName)23 FilterOutByDate (gov.cms.ab2d.filter.FilterOutByDate)14 CoveragePagingRequest (gov.cms.ab2d.coverage.model.CoveragePagingRequest)13 CoveragePagingResult (gov.cms.ab2d.coverage.model.CoveragePagingResult)13 Identifiers (gov.cms.ab2d.coverage.model.Identifiers)11 OffsetDateTime (java.time.OffsetDateTime)10 LinkedHashSet (java.util.LinkedHashSet)10 ContractForCoverageDTO (gov.cms.ab2d.coverage.model.ContractForCoverageDTO)9 CoverageSearchEvent (gov.cms.ab2d.coverage.model.CoverageSearchEvent)9 AB2D_EPOCH (gov.cms.ab2d.common.util.DateUtil.AB2D_EPOCH)8 CoverageCount (gov.cms.ab2d.coverage.model.CoverageCount)8 CoverageJobStatus (gov.cms.ab2d.coverage.model.CoverageJobStatus)8 CoveragePeriod (gov.cms.ab2d.coverage.model.CoveragePeriod)8 List (java.util.List)8 Map (java.util.Map)8 Optional (java.util.Optional)8 CoverageDelta (gov.cms.ab2d.coverage.model.CoverageDelta)7 CoverageMapping (gov.cms.ab2d.coverage.model.CoverageMapping)7