EmrVelocityFunctions { public boolean hasHivUniquePatientNumber() { if (session.getPatient() == null) { return false; } else { PatientIdentifierType pit = MetadataUtils.existing(PatientIdentifierType.class, HivMetadata._PatientIdentifierType.UNIQUE_PATIENT_NUMBER); return session.getPatient().getPatientIdentifier(pit) != null; } } EmrVelocityFunctions(FormEntrySession session); boolean hasHivUniquePatientNumber(); Concept getConcept(String conceptIdentifier); String getGlobalProperty(String name); List<Obs> allObs(String conceptIdentifier); Obs latestObs(String conceptIdentifier); Obs earliestObs(String conceptIdentifier); Obs obsToday(String conceptIdentifier);  }
@Test public void hasHivUniquePatientNumber() { PatientIdentifierType upn = MetadataUtils.existing(PatientIdentifierType.class, HivMetadata._PatientIdentifierType.UNIQUE_PATIENT_NUMBER); TestUtils.savePatientIdentifier(TestUtils.getPatient(7), upn, "1234567890"); Assert.assertThat(functionsForSession2.hasHivUniquePatientNumber(), is(true)); Assert.assertThat(functionsForSession1.hasHivUniquePatientNumber(), is(false)); }