aboutsummaryrefslogtreecommitdiff
path: root/moaSig/moa-sig-lib/src/test
diff options
context:
space:
mode:
authorThomas <>2022-10-13 07:30:27 +0200
committerThomas <>2022-10-13 07:30:27 +0200
commitd0017b73e8dcd2e9b41fe2ee0e89b5bd36fb0353 (patch)
tree07a2823d4bf929db952d320aa1b9cb2e02da7185 /moaSig/moa-sig-lib/src/test
parent91e57360ff98be529a3f8fd074c0b1bbc18fbd19 (diff)
downloadmoa-sig-d0017b73e8dcd2e9b41fe2ee0e89b5bd36fb0353.tar.gz
moa-sig-d0017b73e8dcd2e9b41fe2ee0e89b5bd36fb0353.tar.bz2
moa-sig-d0017b73e8dcd2e9b41fe2ee0e89b5bd36fb0353.zip
feat(iaiklogger): add interface to re-classify log msg from WARN to INFO
Diffstat (limited to 'moaSig/moa-sig-lib/src/test')
-rw-r--r--moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/logger/IaikLoggerMaskingTest.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/logger/IaikLoggerMaskingTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/logger/IaikLoggerMaskingTest.java
index b3bf0e8..da8a8aa 100644
--- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/logger/IaikLoggerMaskingTest.java
+++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/logger/IaikLoggerMaskingTest.java
@@ -171,7 +171,45 @@ public class IaikLoggerMaskingTest {
}
+ @Test
+ public void noMsgReclassification() {
+ String msg = RandomStringUtils.randomAlphanumeric(25);
+
+ //test
+ log.warn(transId, msg, null);
+
+ //verify log
+ assertTrue("Log Msg on Level WARN", verifyMsgOnLevel(Level.WARN, msg));
+
+ }
+ @Test
+ public void msgReclassification() {
+ String msg1 = "Max. cert info store size exceeded, consider using a larger certinfostore.";
+ String msg2 = "my new test mgs";
+ IaikLog.addLogMsgForReclassification(msg2);
+
+ //test
+ log.warn(transId, msg1, null);
+ log.warn(transId, msg2, null);
+
+ //verify log
+ assertFalse("Log Msg on wrong", verifyMsgOnLevel(Level.WARN, msg1));
+ assertTrue("Log Msg on wrong", verifyMsgOnLevel(Level.INFO, msg1));
+
+ assertFalse("Log Msg on wrong", verifyMsgOnLevel(Level.WARN, msg2));
+ assertTrue("Log Msg on wrong", verifyMsgOnLevel(Level.INFO, msg2));
+
+ }
+
+ private boolean verifyMsgOnLevel(Level level, String msg) {
+ return memoryAppender.getLoggedEvents().stream()
+ .filter(el -> el.getLevel().equals(level))
+ .filter(el -> el.getMessage().contains(msg))
+ .findFirst()
+ .isPresent();
+ }
+
private void verifyLogMessge(List<String> checks) {
assertEquals("no log", 1, memoryAppender.getSize());
checks.stream().forEach(