mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-17 00:56:54 +01:00
Added extra setters with null and empty checks.
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user