diff options
author | Thomas <> | 2023-01-25 07:24:35 +0100 |
---|---|---|
committer | Thomas <> | 2023-01-25 07:24:35 +0100 |
commit | a9582ca0832254241ab25aefaf434df4c6b66683 (patch) | |
tree | 7a0198515b80b69c065e1568cac5129a3c4e6eeb /moaSig/moa-sig-lib/src/test | |
parent | 11041becfdb6f55c11ad4a8ba3832559fcb34527 (diff) | |
parent | 1988be4a03eb212261f190df16e9b657a101f8ba (diff) | |
download | moa-sig-a9582ca0832254241ab25aefaf434df4c6b66683.tar.gz moa-sig-a9582ca0832254241ab25aefaf434df4c6b66683.tar.bz2 moa-sig-a9582ca0832254241ab25aefaf434df4c6b66683.zip |
Merge branch 'snapshot/3.1.x' into nightlybuild
# Conflicts:
# moaSig/build.gradle
# moaSig/common/build.gradle
# moaSig/moa-asic/build.gradle
# moaSig/moa-sig-lib/build.gradle
# moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java
# moaSig/moa-sig/build.gradle
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.java | 38 |
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( |