summaryrefslogtreecommitdiff
path: root/eaaf_core_utils/src/test/java
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2019-10-22 13:53:34 +0200
committerThomas Lenz <thomas.lenz@egiz.gv.at>2019-10-22 13:53:34 +0200
commit0e282ba22b3fcc1fa30cf0dc56925f91f98c1631 (patch)
treed79ed7ebf3383cde260b917e5c4be3039f15c1ad /eaaf_core_utils/src/test/java
parent165671bee9688f7a936cec0374a3e2ea3512d715 (diff)
downloadEAAF-Components-0e282ba22b3fcc1fa30cf0dc56925f91f98c1631.tar.gz
EAAF-Components-0e282ba22b3fcc1fa30cf0dc56925f91f98c1631.tar.bz2
EAAF-Components-0e282ba22b3fcc1fa30cf0dc56925f91f98c1631.zip
add JUnitTestStatusMessenger implementation
Diffstat (limited to 'eaaf_core_utils/src/test/java')
-rw-r--r--eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/impl/logging/JUnitTestStatusMessenger.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/impl/logging/JUnitTestStatusMessenger.java b/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/impl/logging/JUnitTestStatusMessenger.java
new file mode 100644
index 00000000..5cdd404c
--- /dev/null
+++ b/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/impl/logging/JUnitTestStatusMessenger.java
@@ -0,0 +1,56 @@
+package at.gv.egiz.eaaf.core.impl.logging;
+
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Map;
+
+import at.gv.egiz.eaaf.core.api.IStatusMessenger;
+
+public class JUnitTestStatusMessenger implements IStatusMessenger {
+
+ private final Map<String, String> msgStore = new HashMap<>();
+
+ @Override
+ public String getMessage(String messageId, Object[] parameters) {
+ final String msg = getMessageWithoutDefault(messageId, parameters);
+ if (msg != null) {
+ return msg;
+
+ } else {
+ return MessageFormat.format(messageId, parameters);
+
+ }
+
+ }
+
+ @Override
+ public String getMessageWithoutDefault(String messageId, Object[] parameters) {
+ if (messageId != null) {
+ if (msgStore.containsKey(messageId)) {
+ return MessageFormat.format(msgStore.get(messageId), parameters);
+
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public String getResponseErrorCode(Throwable throwable) {
+ return null;
+ }
+
+ @Override
+ public String mapInternalErrorToExternalError(String intErrorCode) {
+ return null;
+ }
+
+ public void addMsg(String msgCode, String msg) {
+ if (!msgStore.containsKey(msgCode)) {
+ msgStore.put(msgCode, msg);
+
+ }
+
+ }
+
+}