Skip to content

Conversation

@Blue-B-code
Copy link

Description
Here I implemented unit tests for the ModifyFamily feature in ClientAndroidInterface. These tests verify that families, members, and policies are correctly imported when the insured does not exist in the database, and that proper handling occurs when the insured exists or when errors occur (family not found or server error). The Android environment and global configuration are simulated using mocks, while family, member, and policy data are fully mocked to validate returned content and database insertions.

Type of change
Chore (Testing / CI)

CheckLists
Unit Tests added:

ModifyFamily – Import family successfully
testModifyFamily_ShouldImportFamilyInsureesAndPolicies – PASSED ✅

Ensures a new family, its members, and policies are inserted correctly

Verifies database insertion in tblFamilies, tblInsuree, and tblPolicy

ModifyFamily – Insuree already exists
testModifyFamily_ShouldNotImportIfInsureeExists – PASSED ✅

Ensures no data is imported if the insured exists

Verifies that the user is notified via ShowDialog()

ModifyFamily – Family not found on server
testModifyFamily_ShouldHandleFamilyNotFound – PASSED ✅

Ensures method handles HttpException 404 gracefully

Verifies that the user is notified via ShowDialog()

ModifyFamily – Server error handling
testModifyFamily_ShouldHandleServerError – PASSED ✅

Ensures method handles generic server errors (RuntimeException)

Verifies that the user is notified via ShowDialog()

Notes

Backend communication is not executed; Family, Member, Policy, and newFetchFamilyExecute() are mocked to isolate business logic.

ShowDialog() is mocked to simulate user notifications.

sqlHandler is mocked to simulate database interactions (count and insert operations).

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.

2 participants