Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AB2D-6149] increase ab2d-filters test coverage #388

Merged
merged 14 commits into from
Jun 11, 2024
Merged

[AB2D-6149] increase ab2d-filters test coverage #388

merged 14 commits into from
Jun 11, 2024

Conversation

coilysiren
Copy link
Contributor

@coilysiren coilysiren commented Jun 7, 2024

🎫 Ticket

https://jira.cms.gov/browse/AB2D-6149

🛠 Changes

  • Updates EobUtils to handle a NPE
  • Adds tests for EobUtils and EOBLoadUtilities, both of which should be at 100% test coverage now

ℹ️ Context for reviewers

SonarQube isn't updating the code coverage stats for my PR, so I won't know how much I've increased code coverage until after the merge (I think)

🔒 Security Implications

  • This PR adds a new software dependency or dependencies.
  • This PR modifies or invalidates one or more of our security controls.
  • This PR stores or transmits data that was not stored or transmitted before.
  • This PR requires additional review of its security implications for other reasons.

If any security implications apply, add Jason Ashbaugh (GitHub username: StewGoin) as a reviewer and do not merge this PR without his approval.

ExplanationOfBenefit eobSNF = (ExplanationOfBenefit) eobS;
List<org.hl7.fhir.dstu3.model.Identifier> ids = eobSNF.getIdentifier();
assertNotNull(ids);
assertEquals(ids.size(), 2);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The syntax is assertEquals(expected, actual)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second that !

@@ -30,7 +30,7 @@ public class EOBLoadUtilitiesTest {
}

@Test
public void testType() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests don't need to be marked public

@coilysiren coilysiren changed the title [AB2D-6149] [AB2D-6149] increase ab2d-filters test coverage Jun 7, 2024
@coilysiren coilysiren changed the title [AB2D-6149] increase ab2d-filters test coverage [AB2D-6149] increase ab2d-filters test coverage Jun 7, 2024
Comment on lines +34 to +49
// Our mock FhirVersion class is used to test the switch case statement inside of EOBLoadUtilities.getEOBFromReader.
// We need to extend from a FhirVersionEnum that is actually on our classpath, so we extend from the R4 version.
// We then override the getVersion method to return a version that is not supported by the switch case statement.
// Choosing `FhirVersionEnum.R5` as the version to return here was an arbitrary choice. If we ever add support
// for R5, this test will need to be updated.
class MockFhirVersion extends org.hl7.fhir.r4.hapi.ctx.FhirR4{
public FhirVersionEnum getVersion() {
return FhirVersionEnum.R5;
}
}
class MockFhirContext extends FhirContext {
@Override
public IFhirVersion getVersion() {
return new MockFhirVersion();
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if you can think of a better way to do this

@coilysiren coilysiren self-assigned this Jun 10, 2024
@coilysiren coilysiren marked this pull request as ready for review June 10, 2024 21:15
@coilysiren coilysiren requested a review from a team as a code owner June 10, 2024 21:15
Comment on lines +34 to +48
@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));
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lazily choosing not to assert on the actual dates here

ExplanationOfBenefit eobSNF = (ExplanationOfBenefit) eobS;
List<org.hl7.fhir.dstu3.model.Identifier> ids = eobSNF.getIdentifier();
assertNotNull(ids);
assertEquals(ids.size(), 2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second that !

}

// DSTU3
InputStream inputStream = classLoader.getResourceAsStream("eobdata/EOB-for-Carrier-Claims.json");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the file paths to constants? but I do understand if you dont want to since they are just being used few times in here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather keep it as is, if that's okay!

@coilysiren coilysiren merged commit f1c30ac into main Jun 11, 2024
3 checks passed
@coilysiren coilysiren deleted the AB2D-6149 branch June 11, 2024 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants