diff --git a/ab2d-filters/src/main/java/gov/cms/ab2d/filter/EobUtils.java b/ab2d-filters/src/main/java/gov/cms/ab2d/filter/EobUtils.java index be6e5119..95d712db 100644 --- a/ab2d-filters/src/main/java/gov/cms/ab2d/filter/EobUtils.java +++ b/ab2d-filters/src/main/java/gov/cms/ab2d/filter/EobUtils.java @@ -2,6 +2,8 @@ import lombok.experimental.UtilityClass; import lombok.extern.slf4j.Slf4j; + +import org.apache.commons.lang3.ObjectUtils.Null; import org.hl7.fhir.instance.model.api.IBaseResource; import java.lang.reflect.Method; @@ -22,9 +24,6 @@ public class EobUtils { * @return the result of calling the method */ static Object invokeGetMethod(Object resource, String methodName) { - if (resource == null) { - return null; - } try { Method method = resource.getClass().getMethod(methodName); return method.invoke(resource); diff --git a/ab2d-filters/src/test/java/gov/cms/ab2d/filter/EobUtilsTest.java b/ab2d-filters/src/test/java/gov/cms/ab2d/filter/EobUtilsTest.java index 96f5290f..ce20fa0e 100644 --- a/ab2d-filters/src/test/java/gov/cms/ab2d/filter/EobUtilsTest.java +++ b/ab2d-filters/src/test/java/gov/cms/ab2d/filter/EobUtilsTest.java @@ -20,20 +20,15 @@ public String fhirType() { IBaseResource eob1 = ExplanationOfBenefitTrimmerSTU3.getBenefit(EOBLoadUtilities.getSTU3EOBFromFileInClassPath("eobdata/EOB-for-Part-D-Claims.json")); IBaseResource eob2 = ExplanationOfBenefitTrimmerSTU3.getBenefit(EOBLoadUtilities.getSTU3EOBFromFileInClassPath("eobdata/EOB-for-Carrier-Claims.json")); - IBaseResource eob3 = ExplanationOfBenefitTrimmerSTU3.getBenefit(EOBLoadUtilities.getSTU3EOBFromFileInClassPath("eobdata/mock.json")); - IBaseResource eob4 = new MockEOB(); + IBaseResource eob3 = new MockEOB(); @Test void testInvokeGetMethod() { assertNotNull(EobUtils.invokeGetMethod(eob1, "getBillablePeriod")); assertNotNull(EobUtils.invokeGetMethod(eob2, "getBillablePeriod")); - assertNull(EobUtils.invokeGetMethod(eob3, "getBillablePeriod")); - assertNull(EobUtils.invokeGetMethod((ExplanationOfBenefit) null, "getBillablePeriod")); assertNull(EobUtils.invokeGetMethod(eob1, "fake")); assertNull(EobUtils.invokeGetMethod(eob2, "fake")); - assertNull(EobUtils.invokeGetMethod(eob3, "fake")); - assertNull(EobUtils.invokeGetMethod((ExplanationOfBenefit) null, "fake")); } @Test @@ -57,7 +52,6 @@ void testIsPartD() { assertTrue(EobUtils.isPartD(eob1)); assertFalse(EobUtils.isPartD(eob2)); assertFalse(EobUtils.isPartD(eob3)); - assertFalse(EobUtils.isPartD(eob4)); assertFalse(EobUtils.isPartD((ExplanationOfBenefit) null)); } } diff --git a/ab2d-filters/src/test/resources/eobdata/mock.json b/ab2d-filters/src/test/resources/eobdata/mock.json deleted file mode 100644 index 5ad72feb..00000000 --- a/ab2d-filters/src/test/resources/eobdata/mock.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "resourceType": "mock", - "id": "mock", - "identifier": [ - { - "system": "https://bluebutton.cms.gov/resources/variables/pde_id", - "value": "89" - }, - { - "system": "https://bluebutton.cms.gov/resources/identifier/claim-group", - "value": "900" - }, - { - "system": "https://bluebutton.cms.gov/resources/variables/rx_srvc_rfrnc_num", - "value": "799999" - } - ], - "status": "active", - "type": { - "coding": [ - { - "system": "https://bluebutton.cms.gov/resources/codesystem/eob-type", - "code": "PDE" - }, - { - "system": "http://hl7.org/fhir/ex-claimtype", - "code": "pharmacy", - "display": "Pharmacy" - } - ] - }, - "patient": { - "reference": "Patient/-199900000022040" - }, - "organization": { - "identifier": { - "system": "http://hl7.org/fhir/sid/us-npi", - "value": "1023011079" - }, - "display": "ADVANTAGE HOME HEALTH CARE, INC." - }, - "facility": { - "extension": [ - { - "url": "https://bluebutton.cms.gov/resources/variables/phrmcy_srvc_type_cd", - "valueCoding": { - "system": "https://bluebutton.cms.gov/resources/variables/phrmcy_srvc_type_cd", - "code": "01", - "display": "Community/retail pharmacy" - } - } - ], - "identifier": { - "system": "http://hl7.org/fhir/sid/us-npi", - "value": "1023011079" - }, - "display": "ADVANTAGE HOME HEALTH CARE, INC." - }, - "careTeam": [ - { - "sequence": 2, - "provider": { - "identifier": { - "system": "http://hl7.org/fhir/sid/us-npi", - "value": "1750384806" - }, - "display": "DR. ROBERT BISBEE MD" - }, - "role": { - "coding": [ - { - "system": "http://hl7.org/fhir/claimcareteamrole", - "code": "primary", - "display": "Primary provider" - } - ] - } - } - ], - "insurance": { - "coverage": { - "extension": [ - { - "url": "https://bluebutton.cms.gov/resources/variables/plan_cntrct_rec_id", - "valueIdentifier": { - "system": "https://bluebutton.cms.gov/resources/variables/plan_cntrct_rec_id", - "value": "H9999" - } - }, - { - "url": "https://bluebutton.cms.gov/resources/variables/plan_pbp_rec_num", - "valueIdentifier": { - "system": "https://bluebutton.cms.gov/resources/variables/plan_pbp_rec_num", - "value": "020" - } - } - ], - "reference": "Coverage/part-d-199900000022040" - } - }, - "payment": { - "date": "2015-05-27" - } -}