@Test public void testHasConsent() throws Exception { String patientId = "pid"; List<String> consentIds = new LinkedList<>(); consentIds.add(ConsentConfigurationMocks.TEST_ID1); this.setUpInitializationWithConfigurationMocks(); PatientRepository repository = this.mocker.getInstance(PatientRepository.class); Patient patient = mock(Patient.class); DocumentReference patientRef = mock(DocumentReference.class); XWikiDocument patientDoc = mock(XWikiDocument.class); BaseObject idsHolder = mock(BaseObject.class); doReturn(patient).when(repository).get(patientId); doReturn(patientRef).when(patient).getDocumentReference(); doReturn(patientDoc).when(patient).getXDocument(); doReturn(idsHolder).when(patientDoc).getXObject(any(EntityReference.class)); doReturn(consentIds).when(idsHolder).getListValue(anyString()); Assert.assertTrue(this.mocker.getComponentUnderTest().hasConsent(patient, ConsentConfigurationMocks.TEST_ID1)); Assert.assertFalse(this.mocker.getComponentUnderTest().hasConsent(patient, ConsentConfigurationMocks.TEST_ID2)); Assert.assertFalse(this.mocker.getComponentUnderTest().hasConsent(patient, ConsentConfigurationMocks.TEST_ID3)); }
@Override public boolean hasConsent(String patientId, String consentId) { return this.hasConsent(this.repository.get(patientId), consentId); }
PhenoTipsPatientConsentManager implements ConsentManager, Initializable { @Override public boolean hasConsent(String patientId, String consentId) { return this.hasConsent(this.repository.get(patientId), consentId); } }
PhenoTipsPatientConsentManager implements ConsentManager, Initializable { @Override public boolean hasConsent(String patientId, String consentId) { return this.hasConsent(this.repository.get(patientId), consentId); }  }
PhenoTipsPatientConsentManager implements ConsentManager, Initializable { @Override public boolean hasConsent(String patientId, String consentId) { return this.hasConsent(this.repository.get(patientId), consentId); }  @Override void initialize(); @Override Set<Consent> getSystemConsents(); @Override boolean isValidConsentId(String consentId); @Override Set<Consent> getMissingConsentsForPatient(String patientId); @Override Set<Consent> getMissingConsentsForPatient(Patient patient); @Override Set<Consent> getAllConsentsForPatient(String patientId); @Override Set<Consent> getAllConsentsForPatient(Patient patient); @Override boolean setPatientConsents(Patient patient, Iterable<String> consents); @Override boolean hasConsent(String patientId, String consentId); @Override boolean hasConsent(Patient patient, String consentId); @Override boolean grantConsent(Patient patient, String consentId); @Override boolean revokeConsent(Patient patient, String consentId); @Override JSONArray toJSON(Collection<Consent> consents); @Override Set<Consent> fromJSON(JSONArray consentsJSON); }
PhenoTipsPatientConsentManager implements ConsentManager, Initializable { @Override public boolean hasConsent(String patientId, String consentId) { return this.hasConsent(this.repository.get(patientId), consentId); }  @Override void initialize(); @Override Set<Consent> getSystemConsents(); @Override boolean isValidConsentId(String consentId); @Override Set<Consent> getMissingConsentsForPatient(String patientId); @Override Set<Consent> getMissingConsentsForPatient(Patient patient); @Override Set<Consent> getAllConsentsForPatient(String patientId); @Override Set<Consent> getAllConsentsForPatient(Patient patient); @Override boolean setPatientConsents(Patient patient, Iterable<String> consents); @Override boolean hasConsent(String patientId, String consentId); @Override boolean hasConsent(Patient patient, String consentId); @Override boolean grantConsent(Patient patient, String consentId); @Override boolean revokeConsent(Patient patient, String consentId); @Override JSONArray toJSON(Collection<Consent> consents); @Override Set<Consent> fromJSON(JSONArray consentsJSON);  }