diff options
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.java | 56 |
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); + + } + + } + +} |