Skip to content

Conversation

@Blue-B-code
Copy link

Description
Here I've implemented unit tests for the ClientAndroidInterface class. These tests cover the enrolment upload process, creation and modification of insurees, as well as creation of new families. We used Robolectric to simulate an Android environment and access the application context, and Mockito to mock dependencies such as SQLHandler, Global, Activity, Resources, and StorageManager.

The tests focus on verifying that methods handle data correctly, update the database as expected, and manage UI elements like ProgressDialog.

  • Type of change
    Chore(CI/CD)

  • Checklists
    Unit Tests added and passed:

Upload Enrolments:

testUploadEnrolment_ShouldProcessSuccessfully – PASSED ✅

testUploadEnrolment_ShouldHandleEnrolError – PASSED ✅

Enrol:

testEnrol_ShouldProcessSuccessfully – PASSED ✅

SaveInsuree – Create:

testCreateNewInsuree_ShouldInsertInDatabase – PASSED ✅

SaveInsuree – Modify:

testModifyInsuree_ShouldUpdateInDatabase – PASSED ✅

SaveInsuree – New Family:

testCreateNewFamily_ShouldInsertInDatabase – PASSED ✅

  • Additional notes

Certain methods or attributes in ClientAndroidInterface were adjusted from private to protected to allow mocking with Mockito.

Network calls are not tested directly; tests focus on local data handling and UI behavior.

Helpers like buildFamilyArray, buildInsureeArray, buildPolicyArray, buildPremiumArray, buildInsureeJson, and buildInsureeMap are used to provide mock data for the tests.

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