### Question:
LocationUtility implements GlobalPropertyListener { public static Location getUserDefaultLocation() { return Context.getUserContext().getLocation(); }  static Location getDefaultLocation(); static Location getUserDefaultLocation(); static void setDefaultLocation(Location defaultLocation); @Override void globalPropertyChanged(GlobalProperty newValue); @Override void globalPropertyDeleted(String propertyName); @Override boolean supportsPropertyName(String propertyName);  }### Answer:
@Test public void getUserDefaultLocation_shouldReturnTheUserSpecifiedLocationIfAnyIsSet() { Assert.assertNull(LocationUtility.getUserDefaultLocation()); User user = Context.getAuthenticatedUser(); Map<String, String> properties = user.getUserProperties(); properties.put(OpenmrsConstants.USER_PROPERTY_DEFAULT_LOCATION, "2"); user.setUserProperties(properties); Context.getUserService().saveUser(user); Context.refreshAuthenticatedUser(); Assert.assertEquals("Xanadu", LocationUtility.getUserDefaultLocation().getName()); }
@Test @Verifies(value = "should return the user specified location if any is set", method = "getUserDefaultLocation()") public void getUserDefaultLocation_shouldReturnTheUserSpecifiedLocationIfAnyIsSet() throws Exception { Assert.assertNull(LocationUtility.getUserDefaultLocation()); User user = Context.getAuthenticatedUser(); Map<String, String> properties = user.getUserProperties(); properties.put(OpenmrsConstants.USER_PROPERTY_DEFAULT_LOCATION, "2"); user.setUserProperties(properties); Context.getUserService().saveUser(user); Context.refreshAuthenticatedUser(); Assert.assertEquals("Xanadu", LocationUtility.getUserDefaultLocation().getName()); }