Skip to content

Commit 40bfdc8

Browse files
committed
Unit tests for enrolment upload and improvements to enrolment tests
1 parent 348a3a3 commit 40bfdc8

2 files changed

Lines changed: 393 additions & 62 deletions

File tree

app/src/main/java/org/openimis/imispolicies/ClientAndroidInterface.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2546,10 +2546,14 @@ public int UpdatePolicy(int PolicyId, String PayDate, int policystatus) throws P
25462546
return 1;//Update Success
25472547
}
25482548

2549+
protected ProgressDialog createProgressDialog(String title, String message) {
2550+
return ProgressDialog.show(activity, title, message);
2551+
}
2552+
25492553
@JavascriptInterface
25502554
@SuppressWarnings("unused")
25512555
public void uploadEnrolment() throws Exception {
2552-
final ProgressDialog finalPd = ProgressDialog.show(activity, activity.getResources().getString(R.string.Sync), activity.getResources().getString(R.string.SyncProcessing));
2556+
final ProgressDialog finalPd = createProgressDialog(activity.getResources().getString(R.string.Sync), activity.getResources().getString(R.string.SyncProcessing));
25532557
activity.runOnUiThread(() -> {
25542558
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
25552559
});
@@ -2798,7 +2802,7 @@ public boolean VerifyPhoto(JSONArray insurees) throws JSONException {
27982802
return result;
27992803
}
28002804

2801-
private int Enrol(int CallerId) throws UserException, JSONException, IOException {
2805+
protected int Enrol(int CallerId) throws UserException, JSONException, IOException {
28022806
ArrayList<String> verifiedId = new ArrayList<>();
28032807
myList.clear();
28042808
int rtEnrolledId = 0;
@@ -3129,7 +3133,7 @@ private int Enrol(int CallerId) throws UserException, JSONException, IOException
31293133
return EnrolResult;
31303134
}
31313135

3132-
private int uploadEnrols(
3136+
protected int uploadEnrols(
31333137
@NonNull JSONArray familyArray,
31343138
@NonNull JSONArray insureesArray,
31353139
@NonNull JSONArray policiesArray,
@@ -3578,7 +3582,7 @@ protected void onPostExecute(Boolean aBoolean) {
35783582
}
35793583
}
35803584

3581-
private void DeleteUploadedData(final int FamilyId, ArrayList<String> FamilyIDs, int CallerId) {
3585+
protected void DeleteUploadedData(final int FamilyId, ArrayList<String> FamilyIDs, int CallerId) {
35823586
if (FamilyIDs.size() == 0) {
35833587
FamilyIDs = new ArrayList<>() {{
35843588
add(String.valueOf(FamilyId));

0 commit comments

Comments
 (0)