@Override public void globalPropertyChanged(GlobalProperty newValue) { PersonName.setFormat(newValue.getPropertyValue()); }
ValidateUtil.setDisableValidation(disableValidation); PersonName.setFormat(Context.getAdministrationService().getGlobalProperty( OpenmrsConstants.GLOBAL_PROPERTY_LAYOUT_NAME_FORMAT));
@Test public void getFullName_shouldReturnShortIfPersonNameFormatIsNull() { PersonName pn = new PersonName(); PersonName.setFormat(OpenmrsConstants.PERSON_NAME_FORMAT_LONG); pn.setPrefix("Sr."); pn.setGivenName("Taylor"); pn.setMiddleName("Bob"); pn.setFamilyNamePrefix("Wilson"); pn.setFamilyName("Mark"); pn.setFamilyName2("Jones"); pn.setFamilyNameSuffix("jr."); pn.setDegree("3"); PersonName.setFormat(""); Assert.assertEquals(pn.getFullName(), "Sr. Taylor Bob Mark"); }
/** * @see PersonName#getFullName() */ @Test public void getFullName_shouldNotReturnLongIfPersonNameFormatIsShort() { PersonName pn = new PersonName(); PersonName.setFormat(OpenmrsConstants.PERSON_NAME_FORMAT_LONG); pn.setPrefix("Sr."); pn.setGivenName("Taylor"); pn.setMiddleName("Bob"); pn.setFamilyNamePrefix("Wilson"); pn.setFamilyName("Mark"); pn.setFamilyName2("Jones"); pn.setFamilyNameSuffix("jr."); pn.setDegree("3"); PersonName.setFormat(OpenmrsConstants.PERSON_NAME_FORMAT_SHORT); Assert.assertEquals(pn.getFullName(), "Sr. Taylor Bob Mark"); }
@Test public void getFullName_shouldNotReturnShortIfPersonNameFormatIsLong() { PersonName pn = new PersonName(); PersonName.setFormat(OpenmrsConstants.PERSON_NAME_FORMAT_LONG); pn.setPrefix("Sr."); pn.setGivenName("Taylor"); pn.setMiddleName("Bob"); pn.setFamilyNamePrefix("Wilson"); pn.setFamilyName("Mark"); pn.setFamilyName2("Jones"); pn.setFamilyNameSuffix("jr."); pn.setDegree("3"); Assert.assertEquals(pn.getFullName(), "Sr. Taylor Bob Wilson Mark Jones jr. 3"); }