Skip to content

Conversation

@Blue-B-code
Copy link

  • Description
    Here I implemented unit tests for the claim download feature using the FetchClaims service. These tests verify that claims are correctly retrieved when the network is available and that proper errors are raised when the network is unavailable. The Android environment and global configuration are simulated using mocks, while claim data is fully mocked to validate returned content (services, medications, and claim metadata).

  • Type of change
    Chore (Testing / CI)

  • CheckLists
    Unit Tests added:

Download Claims – Network available

testDownloadClaims_WhenNetworkAvailable_ReturnsClaimsList – PASSED ✅

Ensures a non-empty list of claims is returned

Verifies claim number, patient name, and status

Verifies that services and medications are included

Download Claims – Network unavailable

testDownloadClaims_WhenNetworkUnavailable_ThrowsException – PASSED ✅

Ensures an exception is thrown when there is no network

  • Notes

Backend communication is not executed; FetchClaims is mocked to isolate business logic.

Global.isNetworkAvailable() is used to simulate online/offline states.

A complete Claim object is used to ensure the returned structure matches production expectations.

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.

1 participant