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