Skip to content

Commit

Permalink
remove npe check
Browse files Browse the repository at this point in the history
  • Loading branch information
coilysiren committed Jun 10, 2024
1 parent d081d2a commit df42566
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 114 deletions.
5 changes: 2 additions & 3 deletions ab2d-filters/src/main/java/gov/cms/ab2d/filter/EobUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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));
}
}
104 changes: 0 additions & 104 deletions ab2d-filters/src/test/resources/eobdata/mock.json

This file was deleted.

0 comments on commit df42566

Please sign in to comment.