-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AB2D-6149] increase
ab2d-filters
test coverage (#388)
* linter autofixes * git restore * linter * restore to main * cleanups * more EOBLoadUtilitiesTest * testReaderEOB * docs * docs * EobUtilsTest * testInvokeGetMethod * add more test data * remove npe check * cleanup
- Loading branch information
1 parent
32ab0d2
commit f1c30ac
Showing
2 changed files
with
137 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
ab2d-filters/src/test/java/gov/cms/ab2d/filter/EobUtilsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package gov.cms.ab2d.filter; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import org.hl7.fhir.dstu3.model.ExplanationOfBenefit; | ||
import org.hl7.fhir.instance.model.api.IBaseResource; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class EobUtilsTest { | ||
|
||
class MockEOB extends ExplanationOfBenefit { | ||
@Override | ||
public String fhirType() { | ||
return "mock"; | ||
} | ||
} | ||
|
||
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 = new MockEOB(); | ||
|
||
@Test | ||
void testInvokeGetMethod() { | ||
assertNotNull(EobUtils.invokeGetMethod(eob1, "getBillablePeriod")); | ||
assertNotNull(EobUtils.invokeGetMethod(eob2, "getBillablePeriod")); | ||
|
||
assertNull(EobUtils.invokeGetMethod(eob1, "fake")); | ||
assertNull(EobUtils.invokeGetMethod(eob2, "fake")); | ||
} | ||
|
||
@Test | ||
void testGetStartDate() { | ||
assertNull(EobUtils.getStartDate(eob1)); | ||
assertNotNull(EobUtils.getStartDate(eob2)); | ||
assertNull(EobUtils.getStartDate(eob3)); | ||
assertNull(EobUtils.getStartDate((ExplanationOfBenefit) null)); | ||
} | ||
|
||
@Test | ||
void testGetEndDate() { | ||
assertNull(EobUtils.getEndDate(eob1)); | ||
assertNotNull(EobUtils.getEndDate(eob2)); | ||
assertNull(EobUtils.getEndDate(eob3)); | ||
assertNull(EobUtils.getEndDate((ExplanationOfBenefit) null)); | ||
} | ||
|
||
@Test | ||
void testIsPartD() { | ||
assertTrue(EobUtils.isPartD(eob1)); | ||
assertFalse(EobUtils.isPartD(eob2)); | ||
assertFalse(EobUtils.isPartD(eob3)); | ||
assertFalse(EobUtils.isPartD((ExplanationOfBenefit) null)); | ||
} | ||
} |