StringToGlobalPropertyConverter implements Converter<String, GlobalProperty> { @Override public GlobalProperty convert(String propertyName) { if (StringUtils.isBlank(propertyName)) { return null; } return Context.getAdministrationService().getGlobalPropertyObject(propertyName); }  @Override GlobalProperty convert(String propertyName);  }
@Test public void convert_shouldConvertStringToGlobalProperty() { StringToGlobalPropertyConverter converter = new StringToGlobalPropertyConverter(); GlobalProperty prop = converter.convert("locale.allowed.list"); Assert.assertEquals("en", prop.getPropertyValue()); }
@Test public void convert_shouldReturnNullIfPassedEmptyString() { StringToGlobalPropertyConverter converter = new StringToGlobalPropertyConverter(); GlobalProperty prop = converter.convert(""); Assert.assertNull(prop); }
@Test public void convert_shouldReturnNullIfPassedNull() { StringToGlobalPropertyConverter converter = new StringToGlobalPropertyConverter(); GlobalProperty prop = converter.convert(null); Assert.assertNull(prop); }
@Test public void convert_shouldReturnNullIfNoMatchingProperty() { StringToGlobalPropertyConverter converter = new StringToGlobalPropertyConverter(); GlobalProperty prop = converter.convert("bogus.property"); Assert.assertNull(prop); }