Added extra setters with null and empty checks.

This commit is contained in:
Anthony Whitford
2015-10-31 10:25:50 -07:00
parent 0cbecbe3a0
commit e5744dd63f
2 changed files with 74 additions and 0 deletions

View File

@@ -77,6 +77,32 @@ public class SettingsTest extends BaseTest {
Assert.assertEquals(expResults, value);
}
/**
* Test of setStringIfNotNull method, of class Settings.
*/
@Test
public void testSetStringIfNotNull() {
String key = "nullableProperty";
String value = "someValue";
Settings.setString(key, value);
Settings.setStringIfNotNull(key, null); // NO-OP
String expResults = Settings.getString(key);
Assert.assertEquals(expResults, value);
}
/**
* Test of setStringIfNotNull method, of class Settings.
*/
@Test
public void testSetStringIfNotEmpty() {
String key = "optionalProperty";
String value = "someValue";
Settings.setString(key, value);
Settings.setStringIfNotEmpty(key, ""); // NO-OP
String expResults = Settings.getString(key);
Assert.assertEquals(expResults, value);
}
/**
* Test of getString method, of class Settings.
*/