From c4ef78cc8c7884741649c51ae152b308cabac06e Mon Sep 17 00:00:00 2001
From: ribeaudc <ribeaudc>
Date: Wed, 23 Apr 2008 08:45:42 +0000
Subject: [PATCH] remove: - 'PropertyUtils.getProperty'. change: - Complete
 'PropertyUtils.getMandatoryProperty' with a non-empty check.

SVN: 5757
---
 .../cisd/common/utilities/PropertyUtilsTest.java   | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/common/sourceTest/java/ch/systemsx/cisd/common/utilities/PropertyUtilsTest.java b/common/sourceTest/java/ch/systemsx/cisd/common/utilities/PropertyUtilsTest.java
index 06e6257bfda..bb17bc4865b 100644
--- a/common/sourceTest/java/ch/systemsx/cisd/common/utilities/PropertyUtilsTest.java
+++ b/common/sourceTest/java/ch/systemsx/cisd/common/utilities/PropertyUtilsTest.java
@@ -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));
-- 
GitLab