Skip to content

test: Implement comprehensive integration tests for ReferralSetService and strict assertions - #4110

Open
Agaba-derrick wants to merge 4 commits into
DIGI-UW:developfrom
Agaba-derrick:feat/referral-set-service-integration-tests
Open

test: Implement comprehensive integration tests for ReferralSetService and strict assertions#4110
Agaba-derrick wants to merge 4 commits into
DIGI-UW:developfrom
Agaba-derrick:feat/referral-set-service-integration-tests

Conversation

@Agaba-derrick

Copy link
Copy Markdown
Contributor

Pull Requests Requirements

  • The PR title includes a brief description of the work done, including the
    Issue number if applicable.
  • The PR includes a video showing the changes for the work done.
  • The PR title follows conventional commit label standards.
  • The changes confirm to the OpenElis Global x3
    Styleguide and Design
    documentation.
  • The changes include tests or are validated by existing tests.
  • I have read and agree to the Contributing
    Guidelines of this
    project.

Summary

This PR introduces robust integration tests for the referral module while eliminating weak assertions to align with strict validation standards.

1. Comprehensive ReferralSetService Tests

  • Coverage: Implemented a comprehensive test suite for updateReferralSets, thoroughly testing result persistence, result editing, and cascading soft deletions.
  • Business Logic Validations:
    • Validated that Note insertions strictly abide by duplicateNoteExists constraints (Note.INTERNAL and referenceTableId = "24").
    • Validated Sample Promotion constraints: ensuring a parent Sample transitions to a Finished status only when all related sibling analyses are finalized and results are non-blank.
  • Fixture Fixes: Updated testdata/referral-set.xml with accurate status_of_sample dictionary definitions and added statusService.refreshCache() to properly sync test execution states and avoid lookup errors.
  • Conflict Resolution: Merged the 9 new updateReferralSets test cases with an existing ReferralSetServiceTest.java file (created for createSaveReferralSetsSamplePatientEntry) to consolidate tests into a single file and prevent CI pipeline fragmentation.

2. Strict Assertion Enforcement ("No Null/NotNull" Rule)

  • ReferralTypeServiceTest.java: Refactored the entire file to completely remove all assertNotNull() checks, replacing them with exact assertEquals(...) verifications of returned values.
  • ReferralSetServiceTest.java: Eliminated all assertNull() checks. Deletion validations now rely on strong list-state assertions (using .anyMatch(...) == false) to explicitly guarantee the entity's absence from the active dataset.

3. Code Polish & Formatting

  • Purged all inline pseudo-code debugging comments (e.g., // Execute, // Setup).
  • Verified that all 30 integration tests across the suite pass flawlessly.
  • Enforced project styling requirements by running mvn spotless:apply across all modified classes.

Screenshots

Related Issue

Closes #4109 4109

Other

@github-actions

Copy link
Copy Markdown

👋 Hi, @Agaba-derrick,
Conflicts have been detected against the base branch. Please rebase your branch against the base branch.


This message is automatically generated by prince-chrismc/label-merge-conflicts-action so don't hesitate to report issues/improvements there.

@github-actions github-actions Bot added merge conflict Merge Conflicts and removed merge conflict Merge Conflicts labels Aug 21, 2026
@Agaba-derrick
Agaba-derrick force-pushed the feat/referral-set-service-integration-tests branch from 2a79153 to a674d68 Compare August 21, 2026 16:13
}

@Test
public void updateReferralSets_shouldUpdateExistingReferralResultAndResult() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is this supposed to be updateReferralSets_shouldUpdateExistingReferralResult()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Refactor and Expand Integration Tests for Referral Services

2 participants