Send test coverage in core up to the high 90s.

This commit is contained in:
dsyer
2008-01-30 08:02:29 +00:00
parent 1cf29b8241
commit 152829ba5f
18 changed files with 472 additions and 159 deletions

View File

@@ -23,6 +23,7 @@ import java.util.Properties;
import org.springframework.util.DefaultPropertiesPersister;
import org.springframework.util.PropertiesPersister;
import org.springframework.util.StringUtils;
/**
* Utility to convert a Properties object to a String and back. Ideally this
@@ -48,7 +49,10 @@ public final class PropertiesConverter {
/**
* Parse a String to a Properties object. If string is null, an empty
* Properties object will be returned.
* Properties object will be returned. The input String is a set of
* name=value pairs, delimited by either newline or comma (for brevity). If
* the input String contains a newline it is assumed that the separator is
* newline, otherwise comma.
*
* @param stringToParse String to parse.
* @return Properties parsed from each string.
@@ -61,6 +65,11 @@ public final class PropertiesConverter {
return new Properties();
}
if (!stringToParse.contains("\n")) {
return StringUtils.splitArrayElementsIntoProperties(StringUtils
.commaDelimitedListToStringArray(stringToParse), "=");
}
StringReader stringReader = new StringReader(stringToParse);
Properties properties = new Properties();