Skip to content
Snippets Groups Projects
Commit c4ef78cc authored by ribeaudc's avatar ribeaudc
Browse files

remove: - 'PropertyUtils.getProperty'.

change: - Complete 'PropertyUtils.getMandatoryProperty' with a non-empty check.

SVN: 5757
parent 3b52184c
No related branches found
No related tags found
No related merge requests found
......@@ -53,14 +53,15 @@ public final class PropertyUtilsTest
@Test
public final void testGetMandatoryProperty()
{
boolean fail = true;
try
{
PropertyUtils.getMandatoryProperty(null, null);
fail("Null values not allowed.");
} catch (final AssertionError e)
{
// Nothing to do here.
fail = false;
}
assertFalse(fail);
final Properties properties = new Properties();
final String propertyKey = "key";
try
......@@ -72,6 +73,15 @@ public final class PropertyUtilsTest
assertEquals(String.format(PropertyUtils.NOT_FOUND_PROPERTY_FORMAT, propertyKey, "[]"),
ex.getMessage());
}
properties.setProperty(propertyKey, " ");
try
{
PropertyUtils.getMandatoryProperty(properties, propertyKey);
} catch (final ConfigurationFailureException ex)
{
assertEquals(String.format(PropertyUtils.EMPTY_STRING_FORMAT, propertyKey, "[]"), ex
.getMessage());
}
final String value = "value";
properties.setProperty(propertyKey, value);
assertEquals(value, PropertyUtils.getMandatoryProperty(properties, propertyKey));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment