Issue #730: Remove redundant method from Settings

Pull file loading from loadSuppressionData() to make it easier to read
Add test assertion to happy case Ant task test
This commit is contained in:
Phillip Whittlesea
2017-06-12 01:48:33 +01:00
parent 8021aaed4b
commit 0be494a211
4 changed files with 67 additions and 80 deletions

View File

@@ -564,18 +564,6 @@ public final class Settings {
LOGGER.debug("Setting: {}='{}'", key, value);
}
/**
* Sets a property value from an array.
* <p>
* Note: each value of the array will be joined by the delimiter {@link Settings#ARRAY_SEP}.
*
* @param key the key for the property
* @param value the value for the property
*/
static void setArray(String key, String[] value) {
setString(key, StringUtils.join(value, ARRAY_SEP));
}
/**
* Sets a property value only if the value is not null.
*
@@ -608,7 +596,7 @@ public final class Settings {
*/
public static void setArrayIfNotEmpty(String key, String[] value) {
if (null != value && value.length > 0) {
setArray(key, value);
setString(key, StringUtils.join(value, ARRAY_SEP));
}
}

View File

@@ -336,19 +336,4 @@ public class SettingsTest extends BaseTest {
assertThat("Expected the property to be set", Settings.getString("key"), is("value1"));
}
/**
* Assert {@link Settings#setArray(String, String[])} with multiple values sets a delimited string.
*/
@Test
public void testSetArraySetsADelimitedString() {
// GIVEN an array with values
final String[] array = { "value1", "value2" };
// WHEN setting the array
Settings.setArray("key", array);
// THEN the property is set
assertThat("Expected the property to be set", Settings.getString("key"), is("value1,value2"));
}
}