@Test public void testnotificationStage_is_add_provider() { Patient patient = mock(Patient.class); when(patientRepository.findByUsername(anyString())).thenReturn(patient); String result = nst.notificationStage("username", null); assertEquals("notification_add_provider", result); }
@Override public String notificationStage(String username, String notify) { Patient patient = patientRepository.findByUsername(username); int providerscount = patient.getIndividualProviders().size() + patient.getOrganizationalProviders().size(); int consentscount = patient.getConsents().size(); boolean consentReviewStatus = checkConsentReviewStatus(patient .getConsents()); boolean consentSignedStatus = checkConsentSignedStatus(patient .getConsents()); switch (consentscount) { case 0: { switch (providerscount) { case 0: return "notification_add_provider"; case 1: { if (notify != null) { if (notify.equals("add")) return "notification_add_one_provider_successed"; } else return "notification_add_second_provider"; } case 2: { if (notify != null) { if (notify.equals("add")) return "notification_add_second_provider_successed"; } else return "notification_add_consent"; } default: return "notification_add_consent"; } } case 1: { if (providerscount < 2) return "notification_add_provider"; else { if (notify != null) { if (notify.equals("add")) return "notification_add_consent_successed"; } else if (consentReviewStatus == false) return "notification_review_sign_consent"; else { if (consentSignedStatus == false) return "notification_sign_consent"; } } } default: { if (providerscount < 2) return "notification_add_provider"; else { if (consentReviewStatus == false) return "notification_review_sign_consent"; else { if (consentSignedStatus == false) return "notification_sign_consent"; } return null; } } } }
NotificationServiceImpl implements NotificationService { @Override public String notificationStage(String username, String notify) { Patient patient = patientRepository.findByUsername(username); int providerscount = patient.getIndividualProviders().size() + patient.getOrganizationalProviders().size(); int consentscount = patient.getConsents().size(); boolean consentReviewStatus = checkConsentReviewStatus(patient .getConsents()); boolean consentSignedStatus = checkConsentSignedStatus(patient .getConsents()); switch (consentscount) { case 0: { switch (providerscount) { case 0: return "notification_add_provider"; case 1: { if (notify != null) { if (notify.equals("add")) return "notification_add_one_provider_successed"; } else return "notification_add_second_provider"; } case 2: { if (notify != null) { if (notify.equals("add")) return "notification_add_second_provider_successed"; } else return "notification_add_consent"; } default: return "notification_add_consent"; } } case 1: { if (providerscount < 2) return "notification_add_provider"; else { if (notify != null) { if (notify.equals("add")) return "notification_add_consent_successed"; } else if (consentReviewStatus == false) return "notification_review_sign_consent"; else { if (consentSignedStatus == false) return "notification_sign_consent"; } } } default: { if (providerscount < 2) return "notification_add_provider"; else { if (consentReviewStatus == false) return "notification_review_sign_consent"; else { if (consentSignedStatus == false) return "notification_sign_consent"; } return null; } } } } }
NotificationServiceImpl implements NotificationService { @Override public String notificationStage(String username, String notify) { Patient patient = patientRepository.findByUsername(username); int providerscount = patient.getIndividualProviders().size() + patient.getOrganizationalProviders().size(); int consentscount = patient.getConsents().size(); boolean consentReviewStatus = checkConsentReviewStatus(patient .getConsents()); boolean consentSignedStatus = checkConsentSignedStatus(patient .getConsents()); switch (consentscount) { case 0: { switch (providerscount) { case 0: return "notification_add_provider"; case 1: { if (notify != null) { if (notify.equals("add")) return "notification_add_one_provider_successed"; } else return "notification_add_second_provider"; } case 2: { if (notify != null) { if (notify.equals("add")) return "notification_add_second_provider_successed"; } else return "notification_add_consent"; } default: return "notification_add_consent"; } } case 1: { if (providerscount < 2) return "notification_add_provider"; else { if (notify != null) { if (notify.equals("add")) return "notification_add_consent_successed"; } else if (consentReviewStatus == false) return "notification_review_sign_consent"; else { if (consentSignedStatus == false) return "notification_sign_consent"; } } } default: { if (providerscount < 2) return "notification_add_provider"; else { if (consentReviewStatus == false) return "notification_review_sign_consent"; else { if (consentSignedStatus == false) return "notification_sign_consent"; } return null; } } } } NotificationServiceImpl(PatientRepository patientRepository); }
NotificationServiceImpl implements NotificationService { @Override public String notificationStage(String username, String notify) { Patient patient = patientRepository.findByUsername(username); int providerscount = patient.getIndividualProviders().size() + patient.getOrganizationalProviders().size(); int consentscount = patient.getConsents().size(); boolean consentReviewStatus = checkConsentReviewStatus(patient .getConsents()); boolean consentSignedStatus = checkConsentSignedStatus(patient .getConsents()); switch (consentscount) { case 0: { switch (providerscount) { case 0: return "notification_add_provider"; case 1: { if (notify != null) { if (notify.equals("add")) return "notification_add_one_provider_successed"; } else return "notification_add_second_provider"; } case 2: { if (notify != null) { if (notify.equals("add")) return "notification_add_second_provider_successed"; } else return "notification_add_consent"; } default: return "notification_add_consent"; } } case 1: { if (providerscount < 2) return "notification_add_provider"; else { if (notify != null) { if (notify.equals("add")) return "notification_add_consent_successed"; } else if (consentReviewStatus == false) return "notification_review_sign_consent"; else { if (consentSignedStatus == false) return "notification_sign_consent"; } } } default: { if (providerscount < 2) return "notification_add_provider"; else { if (consentReviewStatus == false) return "notification_review_sign_consent"; else { if (consentSignedStatus == false) return "notification_sign_consent"; } return null; } } } } NotificationServiceImpl(PatientRepository patientRepository); @Override String notificationStage(String username, String notify); @Override boolean checkConsentReviewStatus(Set<Consent> consents); @Override boolean checkConsentSignedStatus(Set<Consent> consents); @Override String notificationValuesetMgmt(String username, String notify,
			String message); }
NotificationServiceImpl implements NotificationService { @Override public String notificationStage(String username, String notify) { Patient patient = patientRepository.findByUsername(username); int providerscount = patient.getIndividualProviders().size() + patient.getOrganizationalProviders().size(); int consentscount = patient.getConsents().size(); boolean consentReviewStatus = checkConsentReviewStatus(patient .getConsents()); boolean consentSignedStatus = checkConsentSignedStatus(patient .getConsents()); switch (consentscount) { case 0: { switch (providerscount) { case 0: return "notification_add_provider"; case 1: { if (notify != null) { if (notify.equals("add")) return "notification_add_one_provider_successed"; } else return "notification_add_second_provider"; } case 2: { if (notify != null) { if (notify.equals("add")) return "notification_add_second_provider_successed"; } else return "notification_add_consent"; } default: return "notification_add_consent"; } } case 1: { if (providerscount < 2) return "notification_add_provider"; else { if (notify != null) { if (notify.equals("add")) return "notification_add_consent_successed"; } else if (consentReviewStatus == false) return "notification_review_sign_consent"; else { if (consentSignedStatus == false) return "notification_sign_consent"; } } } default: { if (providerscount < 2) return "notification_add_provider"; else { if (consentReviewStatus == false) return "notification_review_sign_consent"; else { if (consentSignedStatus == false) return "notification_sign_consent"; } return null; } } } } NotificationServiceImpl(PatientRepository patientRepository); @Override String notificationStage(String username, String notify); @Override boolean checkConsentReviewStatus(Set<Consent> consents); @Override boolean checkConsentSignedStatus(Set<Consent> consents); @Override String notificationValuesetMgmt(String username, String notify,
			String message);  }