aboutsummaryrefslogtreecommitdiffstats
path: root/appc-common/src/main
diff options
context:
space:
mode:
authorJakub Dudycz <jakub.dudycz@nokia.com>2018-03-12 16:05:57 +0100
committerTakamune Cho <tc012c@att.com>2018-03-13 17:56:56 +0000
commitf6f366b5532c51d9166ed68073f611097aec1db4 (patch)
tree4ba4d4709bbc028cc1d7f1748986b818c1cd451d /appc-common/src/main
parent51d88e957a81396a26c909dda6ab05d48decc643 (diff)
MessageFormatter unit tests
Improved code coverage Change-Id: I8ef81c6c8efaa796d62d8913e7dfbf160bf3c02d Issue-ID: APPC-724 Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com>
Diffstat (limited to 'appc-common/src/main')
-rw-r--r--appc-common/src/main/java/org/onap/appc/util/MessageFormatter.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/appc-common/src/main/java/org/onap/appc/util/MessageFormatter.java b/appc-common/src/main/java/org/onap/appc/util/MessageFormatter.java
index 71ef40641..ba56867a0 100644
--- a/appc-common/src/main/java/org/onap/appc/util/MessageFormatter.java
+++ b/appc-common/src/main/java/org/onap/appc/util/MessageFormatter.java
@@ -32,13 +32,11 @@ import java.util.regex.Pattern;
public class MessageFormatter {
private final static String paramNameRegexGroupName = "paramName";
- private final static String paramRegex = "\\$\\{(?<paramName>[^}$]+)\\}"; // start with ${ and
- // after there is one
- // or more characters
- // that are not $ and
- // not } and ended
- // with }
+ /**
+ * start with ${ and after there is one or more characters that are not $ and not } and ended with }
+ */
+ private final static String paramRegex = "\\$\\{(?<paramName>[^}$]+)\\}";
public static String format(String messageTemplate, Map<String, Object> params) {
if (StringUtils.isEmpty(messageTemplate))
@@ -69,7 +67,7 @@ public class MessageFormatter {
public static List<String> getParamsNamesList(String messageTemplate) {
List<String> paramsNames = null;
if (!StringUtils.isEmpty(messageTemplate)) {
- paramsNames = new ArrayList<String>();
+ paramsNames = new ArrayList<>();
Matcher m = Pattern.compile(paramRegex).matcher(messageTemplate);
while (m.find()) {
String paramName = m.group(paramNameRegexGroupName);