summaryrefslogtreecommitdiffstats
path: root/common-logging/src
diff options
context:
space:
mode:
authorwaynedunican <wayne.dunican@est.tech>2024-06-25 14:47:25 +0100
committerwaynedunican <wayne.dunican@est.tech>2024-06-27 12:00:30 +0100
commitcf67c9ea492dcac3cdded351a853653cb38af40c (patch)
tree1270ab27441c9cc410f00fb1d1100c85f49d7855 /common-logging/src
parent0fb3ba9d6e541a6853ea91f20c990a6b66e5c9b5 (diff)
Convert common to JUnit 5
Review for common-logging, common-parameters & gson Issue-ID: POLICY-5043 Change-Id: I0f1dce53716dff8d9c5557a68b2723c6a4752c9f Signed-off-by: waynedunican <wayne.dunican@est.tech>
Diffstat (limited to 'common-logging/src')
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/eelf/DroolsPdpMdcInfoTest.java11
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/eelf/ErrorCodeMapTest.java15
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventDataTest.java33
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoHandlerTest.java25
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoTest.java31
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/eelf/PolicyLoggerTest.java162
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/EelfLoggerTest.java105
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/FlexLoggerTest.java30
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/PropertyUtilTest.java40
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/SystemOutLoggerTest.java115
10 files changed, 283 insertions, 284 deletions
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/DroolsPdpMdcInfoTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/DroolsPdpMdcInfoTest.java
index 96030962..ba72f36b 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/DroolsPdpMdcInfoTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/DroolsPdpMdcInfoTest.java
@@ -3,6 +3,7 @@
* ONAP Policy Engine - Common Modules
* ================================================================================
* Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,19 +21,19 @@
package org.onap.policy.common.logging.eelf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import com.att.eelf.configuration.Configuration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class DroolsPdpMdcInfoTest {
+class DroolsPdpMdcInfoTest {
/**
* Test method for {@link org.onap.policy.common.logging.eelf.DroolsPdpMdcInfo#getMdcInfo()}.
*/
@Test
- public void testGetMdcInfo() {
+ void testGetMdcInfo() {
DroolsPdpMdcInfo di = new DroolsPdpMdcInfo();
assertNotNull(di.getMdcInfo());
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/ErrorCodeMapTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/ErrorCodeMapTest.java
index c34d9696..764b41b2 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/ErrorCodeMapTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/ErrorCodeMapTest.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 AT&T.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,16 +22,16 @@
package org.onap.policy.common.logging.eelf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.logging.eelf.ErrorCodeMap.ErrorCodeInfo;
-public class ErrorCodeMapTest {
+class ErrorCodeMapTest {
@Test
- public void testGetErrorCodeInfo() {
+ void testGetErrorCodeInfo() {
assertNotNull(ErrorCodeMap.getErrorCodeInfo(MessageCodes.EXCEPTION_ERROR));
assertNotNull(ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR));
assertNotNull(ErrorCodeMap.getErrorCodeInfo(MessageCodes.MISS_PROPERTY_ERROR));
@@ -46,13 +47,13 @@ public class ErrorCodeMapTest {
}
@Test
- public void testErrorCodeInfoGetErrorCode() {
+ void testErrorCodeInfoGetErrorCode() {
ErrorCodeInfo errorCodeInfo = ErrorCodeMap.getErrorCodeInfo(MessageCodes.EXCEPTION_ERROR);
assertEquals("500", errorCodeInfo.getErrorCode());
}
@Test
- public void testErrorCodeInfoGetErrorDesc() {
+ void testErrorCodeInfoGetErrorDesc() {
ErrorCodeInfo errorCodeInfo = ErrorCodeMap.getErrorCodeInfo(MessageCodes.EXCEPTION_ERROR);
assertEquals("This is an exception error message during the process. Please check the error message for detail "
+ "information", errorCodeInfo.getErrorDesc());
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventDataTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventDataTest.java
index 882cc2cf..6e518c22 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventDataTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventDataTest.java
@@ -3,6 +3,7 @@
* ONAP Policy Engine - Common Modules
* ================================================================================
* Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,14 +21,14 @@
package org.onap.policy.common.logging.eelf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.time.Instant;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class EventDataTest {
+class EventDataTest {
private static final Instant istart = Instant.ofEpochMilli(100000L);
private static final Instant iend = Instant.ofEpochMilli(200000L);
@@ -35,7 +36,7 @@ public class EventDataTest {
* Test method for {@link EventData#EventData()}.
*/
@Test
- public void testEventData() {
+ void testEventData() {
EventData eventData = new EventData();
assertNull(eventData.getEndTime());
@@ -47,7 +48,7 @@ public class EventDataTest {
* Test method for {@link EventData#EventData(String, Instant, Instant)}.
*/
@Test
- public void testEventDataStringInstantInstant() {
+ void testEventDataStringInstantInstant() {
EventData eventData = new EventData("myreq", istart, iend);
assertEquals("myreq", eventData.getRequestId());
@@ -59,7 +60,7 @@ public class EventDataTest {
* Test method for {@link EventData#getRequestId()} and {@link EventData#setRequestId(String)}.
*/
@Test
- public void testGetSetRequestId() {
+ void testGetSetRequestId() {
EventData eventData = new EventData();
assertNull(eventData.getRequestId());
@@ -74,7 +75,7 @@ public class EventDataTest {
* Test method for {@link EventData#getStartTime()} and {@link EventData#setStartTime(Instant)}.
*/
@Test
- public void testGetSetStartTime() {
+ void testGetSetStartTime() {
EventData eventData = new EventData();
assertNull(eventData.getStartTime());
@@ -93,7 +94,7 @@ public class EventDataTest {
* Test method for {@link EventData#getEndTime()} and {@link EventData#setEndTime(Instant)}.
*/
@Test
- public void testGetSetEndTime() {
+ void testGetSetEndTime() {
EventData eventData = new EventData();
assertNull(eventData.getEndTime());
@@ -112,7 +113,7 @@ public class EventDataTest {
* Test method for {@link EventData#toString()}.
*/
@Test
- public void testToString() {
+ void testToString() {
EventData eventData = new EventData("myreq", istart, iend);
assertEquals("myreq Starting Time : 1970-01-01T00:01:40Z Ending Time : 1970-01-01T00:03:20Z",
eventData.toString());
@@ -122,7 +123,7 @@ public class EventDataTest {
* Test method for {@link EventData#hashCode()}.
*/
@Test
- public void testHashCode() {
+ void testHashCode() {
int hc1 = new EventData("abc", istart, iend).hashCode();
assertNotEquals(hc1, new EventData("abd", istart, iend).hashCode());
@@ -133,7 +134,7 @@ public class EventDataTest {
* Test method for {@link EventData#equals(Object)}.
*/
@Test
- public void testEqualsObject() {
+ void testEqualsObject() {
final EventData d1 = new EventData("abc", istart, iend);
final EventData d2 = new EventData("abd", istart, iend);
final EventData d3 = new EventData("abc", iend, istart);
@@ -142,15 +143,15 @@ public class EventDataTest {
assertEquals(d1, d1);
// compare with null
- assertNotEquals(d1, null);
+ assertNotEquals(null, d1);
// compare with request id
// note: ignoring sonar because we want to test d1.equals(), not "abc".equals()
assertEquals(d1, "abc"); // NOSONAR
- assertNotEquals(d1, "abd");
+ assertNotEquals("abd", d1);
// compare with int - different class type
- assertNotEquals(d1, 10);
+ assertNotEquals(10, d1);
// "this" has null request id
assertNotEquals(new EventData(), d1);
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoHandlerTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoHandlerTest.java
index 2cc1e59e..92d24009 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoHandlerTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoHandlerTest.java
@@ -3,6 +3,7 @@
* ONAP Policy Engine - Common Modules
* ================================================================================
* Copyright (C) 2018, 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,15 +21,15 @@
package org.onap.policy.common.logging.eelf;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.time.Instant;
import java.util.concurrent.ConcurrentMap;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
-public class EventTrackInfoHandlerTest {
+class EventTrackInfoHandlerTest {
private static final Instant inow = Instant.now();
private static final Instant iexpired = Instant.ofEpochMilli(10000L);
@@ -41,7 +42,7 @@ public class EventTrackInfoHandlerTest {
private EventTrackInfoHandler hdlr;
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() {
tracker = PolicyLogger.getEventTracker();
info = tracker.getEventInfo();
@@ -50,21 +51,21 @@ public class EventTrackInfoHandlerTest {
/**
* Perform set up for test cases.
*/
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
info.clear();
hdlr = new EventTrackInfoHandler();
}
@Test
- public void testNoEvents() {
+ void testNoEvents() {
hdlr.run();
assertEquals(0, info.size());
}
@Test
- public void testNothingExpired() {
+ void testNothingExpired() {
tracker.storeEventData(data1);
tracker.storeEventData(data2);
@@ -73,7 +74,7 @@ public class EventTrackInfoHandlerTest {
}
@Test
- public void testSomeExpired() {
+ void testSomeExpired() {
// not expired
tracker.storeEventData(data1);
tracker.storeEventData(data2);
@@ -99,7 +100,7 @@ public class EventTrackInfoHandlerTest {
}
@Test
- public void testMultipleRuns() {
+ void testMultipleRuns() {
hdlr.run();
assertEquals(0, info.size());
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoTest.java
index 0ca5feb5..49a3463f 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoTest.java
@@ -3,6 +3,7 @@
* ONAP Policy Engine - Common Modules
* ================================================================================
* Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,17 +21,17 @@
package org.onap.policy.common.logging.eelf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.time.Instant;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
-public class EventTrackInfoTest {
+class EventTrackInfoTest {
private static final Instant istart = Instant.ofEpochMilli(100000L);
private static final Instant iend = Instant.ofEpochMilli(200000L);
@@ -40,8 +41,8 @@ public class EventTrackInfoTest {
private EventTrackInfo info;
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
info = new EventTrackInfo();
}
@@ -50,7 +51,7 @@ public class EventTrackInfoTest {
* Test method for {@link EventTrackInfo#EventTrackInfo()}.
*/
@Test
- public void testEventTrackInfo() {
+ void testEventTrackInfo() {
assertNotNull(info.getEventInfo());
}
@@ -58,7 +59,7 @@ public class EventTrackInfoTest {
* Test method for {@link EventTrackInfo#getEventDataByRequestId(String)}.
*/
@Test
- public void testGetEventDataByRequestId() {
+ void testGetEventDataByRequestId() {
info.storeEventData(data1);
info.storeEventData(data2);
@@ -71,7 +72,7 @@ public class EventTrackInfoTest {
* Test method for {@link EventTrackInfo#storeEventData(EventData)}.
*/
@Test
- public void testStoreEventData() {
+ void testStoreEventData() {
// should ignore null
info.storeEventData(null);
assertTrue(info.getEventInfo().isEmpty());
@@ -100,7 +101,7 @@ public class EventTrackInfoTest {
* Test method for {@link EventTrackInfo#remove(String)}.
*/
@Test
- public void testRemove() {
+ void testRemove() {
info.storeEventData(data1);
info.storeEventData(data2);
@@ -118,7 +119,7 @@ public class EventTrackInfoTest {
* Test method for {@link EventTrackInfo#getEventInfo()}.
*/
@Test
- public void testGetEventInfo() {
+ void testGetEventInfo() {
info.storeEventData(data1);
info.storeEventData(data2);
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/PolicyLoggerTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/PolicyLoggerTest.java
index 62fcfaf4..d7239f4e 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/PolicyLoggerTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/PolicyLoggerTest.java
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2023-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,11 +32,11 @@ import static com.att.eelf.configuration.Configuration.MDC_SERVER_IP_ADDRESS;
import static com.att.eelf.configuration.Configuration.MDC_SERVICE_INSTANCE_ID;
import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME;
import static org.assertj.core.api.Assertions.assertThatCode;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.never;
import static org.onap.policy.common.logging.eelf.OnapConfigProperties.PARTNER_NAME;
import static org.onap.policy.common.logging.eelf.OnapConfigProperties.RESPONSE_CODE;
@@ -49,26 +49,26 @@ import com.att.eelf.configuration.EELFLogger.Level;
import java.time.Instant;
import java.util.Properties;
import java.util.UUID;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.slf4j.MDC;
import org.springframework.test.util.ReflectionTestUtils;
-public class PolicyLoggerTest {
+class PolicyLoggerTest {
/**
* Perform set up for test cases.
*/
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
Properties properties = new Properties();
properties.setProperty("policy.component", "XACML");
PolicyLogger.init(properties);
}
@Test
- public void testSetAndGetDebugLevelLevel() {
+ void testSetAndGetDebugLevelLevel() {
PolicyLogger.setDebugLevel(Level.INFO);
assertEquals(Level.INFO, PolicyLogger.getDebugLevel());
PolicyLogger.setDebugLevel(Level.DEBUG);
@@ -76,7 +76,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testSetAndGetAuditLevelLevel() {
+ void testSetAndGetAuditLevelLevel() {
PolicyLogger.setAuditLevel(Level.INFO);
assertEquals(Level.INFO, PolicyLogger.getAuditLevel());
PolicyLogger.setAuditLevel(Level.DEBUG);
@@ -84,7 +84,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testSetAndGetMetricsLevelLevel() {
+ void testSetAndGetMetricsLevelLevel() {
PolicyLogger.setMetricsLevel(Level.INFO);
assertEquals(Level.INFO, PolicyLogger.getMetricsLevel());
PolicyLogger.setMetricsLevel(Level.DEBUG);
@@ -92,7 +92,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testSetAndGetErrorLevelLevel() {
+ void testSetAndGetErrorLevelLevel() {
PolicyLogger.setErrorLevel(Level.INFO);
assertEquals(Level.INFO, PolicyLogger.getErrorLevel());
PolicyLogger.setErrorLevel(Level.DEBUG);
@@ -100,14 +100,14 @@ public class PolicyLoggerTest {
}
@Test
- public void testSetAndGetClassname() {
+ void testSetAndGetClassname() {
assertEquals("ClassName", PolicyLogger.getClassname());
PolicyLogger.setClassname("PolicyLoggerTest");
assertEquals("PolicyLoggerTest", PolicyLogger.getClassname());
}
@Test
- public void testPostMdcInfoForEventString() {
+ void testPostMdcInfoForEventString() {
PolicyLogger.postMdcInfoForEvent("transactionId");
assertEquals("", MDC.get(MDC_REMOTE_HOST));
@@ -123,7 +123,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testPostMdcInfoForEventStringDrools() {
+ void testPostMdcInfoForEventStringDrools() {
Properties properties = new Properties();
properties.setProperty("policy.component", "DROOLS");
PolicyLogger.init(properties);
@@ -136,13 +136,13 @@ public class PolicyLoggerTest {
}
@Test
- public void testSetAndGetTransId() {
+ void testSetAndGetTransId() {
PolicyLogger.setTransId("123456");
assertEquals("123456", PolicyLogger.getTransId());
}
@Test
- public void testPostMdcInfoForEventObject() {
+ void testPostMdcInfoForEventObject() {
PolicyLogger.postMdcInfoForEvent(1);
assertEquals("", MDC.get(MDC_REMOTE_HOST));
@@ -158,7 +158,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testPostMdcInfoForTriggeredRule() {
+ void testPostMdcInfoForTriggeredRule() {
PolicyLogger.postMdcInfoForTriggeredRule("transactionId");
assertEquals("", MDC.get(MDC_REMOTE_HOST));
@@ -173,7 +173,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testPostMdcUuidForTriggeredRule() {
+ void testPostMdcUuidForTriggeredRule() {
PolicyLogger.postMdcUuidForTriggeredRule(1);
assertEquals("", MDC.get(MDC_REMOTE_HOST));
@@ -188,7 +188,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testInfoMessageCodesStringStringArray() {
+ void testInfoMessageCodesStringStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.info(MessageCodes.ERROR_DATA_ISSUE, "str1", "str2");
@@ -196,7 +196,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testInfoStringString() {
+ void testInfoStringString() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.info("str1", "str2");
@@ -207,7 +207,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testInfoObject() {
+ void testInfoObject() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.info("str1");
@@ -215,7 +215,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testInfoMessageCodesThrowableStringArray() {
+ void testInfoMessageCodesThrowableStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.info(MessageCodes.ERROR_DATA_ISSUE, new NullPointerException(), "str1", "str2");
@@ -224,7 +224,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testInfoMessageCodesStringThrowableStringArray() {
+ void testInfoMessageCodesStringThrowableStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.info(MessageCodes.ERROR_DATA_ISSUE, "PolicyLoggerTest", new NullPointerException(), "str1",
@@ -234,7 +234,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testWarnMessageCodesStringStringArray() {
+ void testWarnMessageCodesStringStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.warn(MessageCodes.ERROR_DATA_ISSUE, "str1");
@@ -242,7 +242,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testWarnStringString() {
+ void testWarnStringString() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.warn("str1", "str2");
@@ -253,7 +253,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testWarnObject() {
+ void testWarnObject() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.warn(1);
@@ -261,7 +261,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testWarnMessageCodesThrowableStringArray() {
+ void testWarnMessageCodesThrowableStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.warn(MessageCodes.ERROR_DATA_ISSUE, new NullPointerException(), "str1", "str2");
@@ -270,7 +270,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testWarnMessageCodesStringThrowableStringArray() {
+ void testWarnMessageCodesStringThrowableStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.warn(MessageCodes.ERROR_DATA_ISSUE, "PolicyLoggerTest", new NullPointerException(), "str1",
@@ -280,7 +280,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testWarnString() {
+ void testWarnString() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.warn("str1");
@@ -288,7 +288,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testErrorStringString() {
+ void testErrorStringString() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "errorLogger", mockLogger);
PolicyLogger.error("str1", "str2");
@@ -302,7 +302,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testErrorString() {
+ void testErrorString() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "errorLogger", mockLogger);
PolicyLogger.error("str1");
@@ -314,7 +314,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testErrorObject() {
+ void testErrorObject() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "errorLogger", mockLogger);
PolicyLogger.error(1);
@@ -326,7 +326,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testErrorMessageCodesThrowableStringArray() {
+ void testErrorMessageCodesThrowableStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "errorLogger", mockLogger);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, new NullPointerException(), "str1", "str2");
@@ -335,7 +335,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testErrorMessageCodesStringThrowableStringArray() {
+ void testErrorMessageCodesStringThrowableStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "errorLogger", mockLogger);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, "PolicyLoggerTest", new NullPointerException(), "str1",
@@ -345,7 +345,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testErrorMessageCodesStringArray() {
+ void testErrorMessageCodesStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "errorLogger", mockLogger);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, "str1", "str2");
@@ -353,7 +353,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testDebugMessageCodesStringArray() {
+ void testDebugMessageCodesStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.debug(MessageCodes.ERROR_DATA_ISSUE, "str1", "str2");
@@ -361,7 +361,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testDebugStringString() {
+ void testDebugStringString() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.debug("str1", "str2");
@@ -372,7 +372,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testDebugString() {
+ void testDebugString() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.debug("str1");
@@ -380,7 +380,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testDebugObject() {
+ void testDebugObject() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.debug(1);
@@ -388,7 +388,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testAuditStringObject() {
+ void testAuditStringObject() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "auditLogger", mockLogger);
PolicyLogger.audit("PolicyLoggerTest", 1);
@@ -401,7 +401,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testAuditObject() {
+ void testAuditObject() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "auditLogger", mockLogger);
PolicyLogger.audit(1);
@@ -411,7 +411,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testDebugMessageCodesThrowableStringArray() {
+ void testDebugMessageCodesThrowableStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.debug(MessageCodes.ERROR_DATA_ISSUE, new NullPointerException(), "str1", "str2");
@@ -420,7 +420,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testDebugMessageCodesStringThrowableStringArray() {
+ void testDebugMessageCodesStringThrowableStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.debug(MessageCodes.ERROR_DATA_ISSUE, "PolicyLoggerTest", new NullPointerException(), "str1",
@@ -430,7 +430,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testIsDebugEnabled() {
+ void testIsDebugEnabled() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
Mockito.when(mockLogger.isDebugEnabled()).thenReturn(false).thenReturn(true);
@@ -439,7 +439,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testIsErrorEnabled() {
+ void testIsErrorEnabled() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "errorLogger", mockLogger);
Mockito.when(mockLogger.isErrorEnabled()).thenReturn(false).thenReturn(true);
@@ -448,7 +448,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testIsWarnEnabled() {
+ void testIsWarnEnabled() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
Mockito.when(mockLogger.isWarnEnabled()).thenReturn(false).thenReturn(true);
@@ -457,7 +457,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testIsInfoEnabled1() {
+ void testIsInfoEnabled1() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
Mockito.when(mockLogger.isInfoEnabled()).thenReturn(false).thenReturn(true);
@@ -466,7 +466,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testIsAuditEnabled() {
+ void testIsAuditEnabled() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
Mockito.when(mockLogger.isInfoEnabled()).thenReturn(false).thenReturn(true);
@@ -475,7 +475,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testIsInfoEnabled() {
+ void testIsInfoEnabled() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
Mockito.when(mockLogger.isInfoEnabled()).thenReturn(false).thenReturn(true);
@@ -484,7 +484,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testTraceStringString() {
+ void testTraceStringString() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.trace("str1", "str2");
@@ -492,7 +492,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testTraceObject() {
+ void testTraceObject() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.trace(1);
@@ -500,7 +500,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testRecordAuditEventStartAndEnd() {
+ void testRecordAuditEventStartAndEnd() {
PolicyLogger.recordAuditEventStart("eventId");
assertNotNull(PolicyLogger.getEventTracker().getEventInfo().get("eventId"));
@@ -509,7 +509,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testRecordAuditEventStartAndEndUuid() {
+ void testRecordAuditEventStartAndEndUuid() {
UUID uuid = UUID.randomUUID();
PolicyLogger.recordAuditEventStart(uuid);;
assertNotNull(PolicyLogger.getEventTracker().getEventInfo().get(uuid.toString()));
@@ -520,7 +520,7 @@ public class PolicyLoggerTest {
@Test
- public void testRecordAuditEventEndStringStringString() {
+ void testRecordAuditEventEndStringStringString() {
PolicyLogger.recordAuditEventStart("eventId");
assertNotNull(PolicyLogger.getEventTracker().getEventInfo().get("eventId"));
@@ -529,7 +529,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testRecordAuditEventEndUuidStringString() {
+ void testRecordAuditEventEndUuidStringString() {
UUID uuid = UUID.randomUUID();
PolicyLogger.recordAuditEventStart(uuid);;
assertNotNull(PolicyLogger.getEventTracker().getEventInfo().get(uuid.toString()));
@@ -540,7 +540,7 @@ public class PolicyLoggerTest {
@Test
- public void testCreatAuditEventTrackingRecordStringStringString() {
+ void testCreatAuditEventTrackingRecordStringStringString() {
PolicyLogger.recordAuditEventStart("eventId");
assertNotNull(PolicyLogger.getEventTracker().getEventInfo().get("eventId"));
@@ -549,7 +549,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testCreatAuditEventTrackingRecordUuidString() {
+ void testCreatAuditEventTrackingRecordUuidString() {
UUID uuid = UUID.randomUUID();
PolicyLogger.recordAuditEventStart(uuid);;
assertNotNull(PolicyLogger.getEventTracker().getEventInfo().get(uuid.toString()));
@@ -559,32 +559,32 @@ public class PolicyLoggerTest {
}
@Test
- public void testRecordAuditEventStartToEnd() {
+ void testRecordAuditEventStartToEnd() {
PolicyLogger.recordAuditEventStartToEnd("eventId", "rule", Instant.now(), Instant.now(), "policyVersion");
assertEquals("eventId", MDC.get(MDC_KEY_REQUEST_ID));
}
@Test
- public void testRecordMetricEventStringString() {
+ void testRecordMetricEventStringString() {
PolicyLogger.recordMetricEvent("eventId", "str1");
assertEquals("eventId", MDC.get(MDC_KEY_REQUEST_ID));
}
@Test
- public void testRecordMetricEventStringStringString() {
+ void testRecordMetricEventStringStringString() {
PolicyLogger.recordMetricEvent("eventId", "PolicyLoggerTest", "str1");
assertEquals("eventId", MDC.get(MDC_KEY_REQUEST_ID));
}
@Test
- public void testRecordMetricEventUuidString() {
+ void testRecordMetricEventUuidString() {
UUID uuid = UUID.randomUUID();
PolicyLogger.recordMetricEvent(uuid, "str1");
assertEquals(uuid.toString(), MDC.get(MDC_KEY_REQUEST_ID));
}
@Test
- public void testRecordMetricEventString() {
+ void testRecordMetricEventString() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "metricsLogger", mockLogger);
PolicyLogger.recordMetricEvent("eventId");
@@ -593,7 +593,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testMetricsString() {
+ void testMetricsString() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "metricsLogger", mockLogger);
PolicyLogger.metrics("str1");
@@ -602,7 +602,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testMetricsStringObject() {
+ void testMetricsStringObject() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "metricsLogger", mockLogger);
PolicyLogger.metrics("PolicyLoggerTest", 1);
@@ -614,7 +614,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testMetricsObject() {
+ void testMetricsObject() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "metricsLogger", mockLogger);
PolicyLogger.metrics(1);
@@ -623,7 +623,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testMetricsPrintln() {
+ void testMetricsPrintln() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "metricsLogger", mockLogger);
PolicyLogger.metricsPrintln("str1");
@@ -631,12 +631,12 @@ public class PolicyLoggerTest {
}
@Test
- public void testInitNullProperties() {
+ void testInitNullProperties() {
assertThatCode(() -> PolicyLogger.init(null)).doesNotThrowAnyException();
}
@Test
- public void testInit() {
+ void testInit() {
Properties properties = new Properties();
properties.setProperty("override.logback.level.setup", "true");
properties.setProperty("metricsLogger.level", "OFF");
@@ -653,56 +653,56 @@ public class PolicyLoggerTest {
}
@Test
- public void testSetDebugLevelString() {
+ void testSetDebugLevelString() {
PolicyLogger.setOverrideLogbackLevel(true);
PolicyLogger.setDebugLevel("TRACE");
assertEquals(Level.TRACE, PolicyLogger.getDebugLevel());
}
@Test
- public void testSetErrorLevelStringOff() {
+ void testSetErrorLevelStringOff() {
PolicyLogger.setOverrideLogbackLevel(true);
PolicyLogger.setErrorLevel("OFF");
assertEquals(Level.OFF, PolicyLogger.getErrorLevel());
}
@Test
- public void testSetErrorLevelStringOther() {
+ void testSetErrorLevelStringOther() {
PolicyLogger.setOverrideLogbackLevel(true);
PolicyLogger.setErrorLevel("INFO");
assertEquals(Level.ERROR, PolicyLogger.getErrorLevel());
}
@Test
- public void testSetMetricsLevelStringOff() {
+ void testSetMetricsLevelStringOff() {
PolicyLogger.setOverrideLogbackLevel(true);
PolicyLogger.setMetricsLevel("OFF");
assertEquals(Level.OFF, PolicyLogger.getMetricsLevel());
}
@Test
- public void testSetMetricsLevelStringOther() {
+ void testSetMetricsLevelStringOther() {
PolicyLogger.setOverrideLogbackLevel(true);
PolicyLogger.setMetricsLevel("ERROR");
assertEquals(Level.INFO, PolicyLogger.getMetricsLevel());
}
@Test
- public void testSetAuditLevelStringOff() {
+ void testSetAuditLevelStringOff() {
PolicyLogger.setOverrideLogbackLevel(true);
PolicyLogger.setAuditLevel("OFF");
assertEquals(Level.OFF, PolicyLogger.getAuditLevel());
}
@Test
- public void testSetAuditLevelStringOther() {
+ void testSetAuditLevelStringOther() {
PolicyLogger.setOverrideLogbackLevel(true);
PolicyLogger.setAuditLevel("ERROR");
assertEquals(Level.INFO, PolicyLogger.getAuditLevel());
}
@Test
- public void testSetAndIsOverrideLogbackLevel() {
+ void testSetAndIsOverrideLogbackLevel() {
PolicyLogger.setOverrideLogbackLevel(false);
assertFalse(PolicyLogger.isOverrideLogbackLevel());
PolicyLogger.setOverrideLogbackLevel(true);
@@ -710,7 +710,7 @@ public class PolicyLoggerTest {
}
@Test
- public void testSetServerInfo() {
+ void testSetServerInfo() {
PolicyLogger.setServerInfo("serverHost", "serverPort");
assertEquals("serverHost:serverPort", MDC.get(SERVER_NAME));
}
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/EelfLoggerTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/EelfLoggerTest.java
index 1d77451b..66b48e07 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/EelfLoggerTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/EelfLoggerTest.java
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2023-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,75 +23,75 @@
package org.onap.policy.common.logging.flexlogger;
import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.never;
import com.att.eelf.configuration.EELFLogger;
import java.util.UUID;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.onap.policy.common.logging.eelf.MessageCodes;
import org.onap.policy.common.logging.eelf.PolicyLogger;
import org.slf4j.MDC;
import org.springframework.test.util.ReflectionTestUtils;
-public class EelfLoggerTest {
+class EelfLoggerTest {
EelfLogger eelfLogger = new EelfLogger("EelfLoggerTest", "transactionId");
@Test
- public void testEelfLoggerClassOfQ() {
+ void testEelfLoggerClassOfQ() {
new EelfLogger(this.getClass());
assertNotNull(PolicyLogger.getTransId());
assertFalse(PolicyLogger.getTransId().isEmpty());
}
@Test
- public void testEelfLoggerString() {
+ void testEelfLoggerString() {
new EelfLogger("EelfLoggerTest");
assertNotNull(PolicyLogger.getTransId());
assertFalse(PolicyLogger.getTransId().isEmpty());
}
@Test
- public void testEelfLoggerClassOfQBoolean() {
+ void testEelfLoggerClassOfQBoolean() {
new EelfLogger(this.getClass(), true);
assertNotNull(PolicyLogger.getTransId());
assertFalse(PolicyLogger.getTransId().isEmpty());
}
@Test
- public void testEelfLoggerStringBoolean() {
+ void testEelfLoggerStringBoolean() {
new EelfLogger("EelfLoggerTest", true);
assertNotNull(PolicyLogger.getTransId());
assertFalse(PolicyLogger.getTransId().isEmpty());
}
@Test
- public void testEelfLoggerClassOfQString() {
+ void testEelfLoggerClassOfQString() {
new EelfLogger(this.getClass(), "transactionId");
assertEquals("transactionId", PolicyLogger.getTransId());
}
@Test
- public void testEelfLoggerStringString() {
+ void testEelfLoggerStringString() {
new EelfLogger("EelfLoggerTest", "transactionId");
assertEquals("transactionId", PolicyLogger.getTransId());
}
@Test
- public void testSetAndGetTransId() {
+ void testSetAndGetTransId() {
assertEquals("transactionId", eelfLogger.getTransId());
eelfLogger.setTransId("transactionId2");
assertEquals("transactionId2", eelfLogger.getTransId());
}
@Test
- public void testDebugObject() {
+ void testDebugObject() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
eelfLogger.debug("message");
@@ -102,7 +102,7 @@ public class EelfLoggerTest {
}
@Test
- public void testErrorObject() {
+ void testErrorObject() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "errorLogger", mockLogger);
eelfLogger.error("message");
@@ -113,7 +113,7 @@ public class EelfLoggerTest {
}
@Test
- public void testInfoObject() {
+ void testInfoObject() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
eelfLogger.info("message");
@@ -124,7 +124,7 @@ public class EelfLoggerTest {
}
@Test
- public void testWarnObject() {
+ void testWarnObject() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
eelfLogger.warn("message");
@@ -135,7 +135,7 @@ public class EelfLoggerTest {
}
@Test
- public void testTraceObject() {
+ void testTraceObject() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
eelfLogger.trace("message");
@@ -143,7 +143,7 @@ public class EelfLoggerTest {
}
@Test
- public void testIsDebugEnabled() {
+ void testIsDebugEnabled() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
Mockito.when(mockLogger.isDebugEnabled()).thenReturn(false).thenReturn(true);
@@ -153,7 +153,7 @@ public class EelfLoggerTest {
}
@Test
- public void testIsInfoEnabled() {
+ void testIsInfoEnabled() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
Mockito.when(mockLogger.isInfoEnabled()).thenReturn(false).thenReturn(true);
@@ -162,7 +162,7 @@ public class EelfLoggerTest {
}
@Test
- public void testIsWarnEnabled() {
+ void testIsWarnEnabled() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
Mockito.when(mockLogger.isWarnEnabled()).thenReturn(false).thenReturn(true);
@@ -171,7 +171,7 @@ public class EelfLoggerTest {
}
@Test
- public void testIsErrorEnabled() {
+ void testIsErrorEnabled() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "errorLogger", mockLogger);
Mockito.when(mockLogger.isErrorEnabled()).thenReturn(false).thenReturn(true);
@@ -180,21 +180,14 @@ public class EelfLoggerTest {
}
@Test
- public void testIsAuditEnabled() {
- PolicyLogger.setOverrideLogbackLevel(true);
- PolicyLogger.setAuditLevel("ERROR");
- assertTrue(eelfLogger.isAuditEnabled());
- }
-
- @Test
- public void testIsMetricsEnabled() {
+ void testIsMetricsEnabled() {
PolicyLogger.setOverrideLogbackLevel(true);
PolicyLogger.setMetricsLevel("ERROR");
assertTrue(eelfLogger.isMetricsEnabled());
}
@Test
- public void testIsTraceEnabled() {
+ void testIsTraceEnabled() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
Mockito.when(mockLogger.isDebugEnabled()).thenReturn(false).thenReturn(true);
@@ -203,14 +196,14 @@ public class EelfLoggerTest {
}
@Test
- public void testAuditObject() {
+ void testAuditObject() {
PolicyLogger.setOverrideLogbackLevel(true);
PolicyLogger.setAuditLevel("ERROR");
assertTrue(eelfLogger.isAuditEnabled());
}
@Test
- public void testDebugObjectThrowable() {
+ void testDebugObjectThrowable() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
eelfLogger.debug("message", new NullPointerException());
@@ -219,7 +212,7 @@ public class EelfLoggerTest {
}
@Test
- public void testErrorObjectThrowable() {
+ void testErrorObjectThrowable() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "errorLogger", mockLogger);
eelfLogger.error("message", new NullPointerException());
@@ -229,7 +222,7 @@ public class EelfLoggerTest {
}
@Test
- public void testInfoObjectThrowable() {
+ void testInfoObjectThrowable() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
eelfLogger.info("message", new NullPointerException());
@@ -240,7 +233,7 @@ public class EelfLoggerTest {
}
@Test
- public void testWarnObjectThrowable() {
+ void testWarnObjectThrowable() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
eelfLogger.warn("message", new NullPointerException());
@@ -249,7 +242,7 @@ public class EelfLoggerTest {
}
@Test
- public void testTraceObjectThrowable() {
+ void testTraceObjectThrowable() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
eelfLogger.trace("message", new NullPointerException());
@@ -257,7 +250,7 @@ public class EelfLoggerTest {
}
@Test
- public void testAuditObjectThrowable() {
+ void testAuditObjectThrowable() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "auditLogger", mockLogger);
eelfLogger.audit("message", new NullPointerException());
@@ -265,20 +258,20 @@ public class EelfLoggerTest {
}
@Test
- public void testRecordAuditEventStartString() {
+ void testRecordAuditEventStartString() {
eelfLogger.recordAuditEventStart("eventId");
assertNotNull(PolicyLogger.getEventTracker().getEventInfo().get("eventId"));
}
@Test
- public void testRecordAuditEventStartUuid() {
+ void testRecordAuditEventStartUuid() {
UUID uuid = UUID.randomUUID();
eelfLogger.recordAuditEventStart(uuid);
assertNotNull(PolicyLogger.getEventTracker().getEventInfo().get(uuid.toString()));
}
@Test
- public void testRecordAuditEventEndStringStringString() {
+ void testRecordAuditEventEndStringStringString() {
eelfLogger.recordAuditEventStart("eventId");
assertNotNull(PolicyLogger.getEventTracker().getEventInfo().get("eventId"));
@@ -287,7 +280,7 @@ public class EelfLoggerTest {
}
@Test
- public void testRecordAuditEventEndUuidStringString() {
+ void testRecordAuditEventEndUuidStringString() {
UUID uuid = UUID.randomUUID();
eelfLogger.recordAuditEventStart(uuid);;
assertNotNull(PolicyLogger.getEventTracker().getEventInfo().get(uuid.toString()));
@@ -297,7 +290,7 @@ public class EelfLoggerTest {
}
@Test
- public void testRecordAuditEventEndStringString() {
+ void testRecordAuditEventEndStringString() {
eelfLogger.recordAuditEventStart("eventId");
assertNotNull(PolicyLogger.getEventTracker().getEventInfo().get("eventId"));
@@ -306,7 +299,7 @@ public class EelfLoggerTest {
}
@Test
- public void testRecordAuditEventEndUuidString() {
+ void testRecordAuditEventEndUuidString() {
UUID uuid = UUID.randomUUID();
eelfLogger.recordAuditEventStart(uuid);;
assertNotNull(PolicyLogger.getEventTracker().getEventInfo().get(uuid.toString()));
@@ -316,20 +309,20 @@ public class EelfLoggerTest {
}
@Test
- public void testRecordMetricEventStringString() {
+ void testRecordMetricEventStringString() {
eelfLogger.recordMetricEvent("eventId", "str1");
assertEquals("eventId", MDC.get(MDC_KEY_REQUEST_ID));
}
@Test
- public void testRecordMetricEventUuidString() {
+ void testRecordMetricEventUuidString() {
UUID uuid = UUID.randomUUID();
eelfLogger.recordMetricEvent(uuid, "str2");
assertEquals(uuid.toString(), MDC.get(MDC_KEY_REQUEST_ID));
}
@Test
- public void testMetrics() {
+ void testMetrics() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "metricsLogger", mockLogger);
eelfLogger.metrics(1);
@@ -341,7 +334,7 @@ public class EelfLoggerTest {
}
@Test
- public void testErrorMessageCodesThrowableStringArray() {
+ void testErrorMessageCodesThrowableStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "errorLogger", mockLogger);
eelfLogger.error(MessageCodes.GENERAL_ERROR, new NullPointerException(), "str1", "str2");
@@ -350,7 +343,7 @@ public class EelfLoggerTest {
}
@Test
- public void testErrorMessageCodesStringArray() {
+ void testErrorMessageCodesStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "errorLogger", mockLogger);
eelfLogger.error(MessageCodes.GENERAL_ERROR, "str1", "str2");
@@ -359,13 +352,13 @@ public class EelfLoggerTest {
}
@Test
- public void testPostMdcInfoForEventString() {
+ void testPostMdcInfoForEventString() {
eelfLogger.postMdcInfoForEvent("transactionId");
assertEquals("transactionId", MDC.get(MDC_KEY_REQUEST_ID));
}
@Test
- public void testWarnMessageCodesStringArray() {
+ void testWarnMessageCodesStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
eelfLogger.warn(MessageCodes.GENERAL_ERROR, "str1", "str2");
@@ -373,7 +366,7 @@ public class EelfLoggerTest {
}
@Test
- public void testWarnMessageCodesThrowableStringArray() {
+ void testWarnMessageCodesThrowableStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
ReflectionTestUtils.setField(PolicyLogger.class, "debugLogger", mockLogger);
eelfLogger.warn(MessageCodes.GENERAL_ERROR, new NullPointerException(), "str1", "str2");
@@ -383,13 +376,13 @@ public class EelfLoggerTest {
}
@Test
- public void testPostMdcInfoForTriggeredRule() {
+ void testPostMdcInfoForTriggeredRule() {
eelfLogger.postMdcInfoForTriggeredRule("transactionId");
assertEquals("transactionId", MDC.get(MDC_KEY_REQUEST_ID));
}
@Test
- public void testPostMDdcInfoForEventObject() {
+ void testPostMDdcInfoForEventObject() {
eelfLogger.postMdcInfoForEvent(1);
assertEquals("1", MDC.get(MDC_KEY_REQUEST_ID));
}
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/FlexLoggerTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/FlexLoggerTest.java
index c0194f2b..547f0a4a 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/FlexLoggerTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/FlexLoggerTest.java
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2023-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,20 +23,20 @@
package org.onap.policy.common.logging.flexlogger;
import static org.assertj.core.api.Assertions.assertThatCode;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.logging.flexlogger.FlexLogger.PropertiesCallBack;
import org.springframework.test.util.ReflectionTestUtils;
-public class FlexLoggerTest {
+class FlexLoggerTest {
@Test
- public void testGetLoggerClassOfQEelf() {
+ void testGetLoggerClassOfQEelf() {
ReflectionTestUtils.setField(FlexLogger.class, "loggerType", LoggerType.EELF);
Logger logger = FlexLogger.getLogger((Class<?>) null);
assertSame(logger, FlexLogger.getLogger((Class<?>) null));
@@ -44,61 +44,61 @@ public class FlexLoggerTest {
}
@Test
- public void testGetLoggerClassOfQSystemOut() {
+ void testGetLoggerClassOfQSystemOut() {
ReflectionTestUtils.setField(FlexLogger.class, "loggerType", LoggerType.SYSTEMOUT);
Logger logger = FlexLogger.getLogger(this.getClass());
assertSame(logger, FlexLogger.getLogger(this.getClass()));
}
@Test
- public void testGetLoggerStringEelf() {
+ void testGetLoggerStringEelf() {
ReflectionTestUtils.setField(FlexLogger.class, "loggerType", LoggerType.EELF);
Logger logger = FlexLogger.getLogger();
assertSame(logger, FlexLogger.getLogger());
}
@Test
- public void testGetLoggerStringSystemOut() {
+ void testGetLoggerStringSystemOut() {
ReflectionTestUtils.setField(FlexLogger.class, "loggerType", LoggerType.SYSTEMOUT);
Logger logger = FlexLogger.getLogger();
assertSame(logger, FlexLogger.getLogger());
}
@Test
- public void testGetLoggerClassOfQBooleanEelf() {
+ void testGetLoggerClassOfQBooleanEelf() {
ReflectionTestUtils.setField(FlexLogger.class, "loggerType", LoggerType.EELF);
Logger logger = FlexLogger.getLogger(this.getClass(), true);
assertSame(logger, FlexLogger.getLogger(this.getClass(), true));
}
@Test
- public void testGetLoggerClassOfQBooleanSystemOut() {
+ void testGetLoggerClassOfQBooleanSystemOut() {
ReflectionTestUtils.setField(FlexLogger.class, "loggerType", LoggerType.SYSTEMOUT);
Logger logger = FlexLogger.getLogger(this.getClass(), true);
assertSame(logger, FlexLogger.getLogger(this.getClass(), true));
}
@Test
- public void testGetLoggerStringBooleanEelf() {
+ void testGetLoggerStringBooleanEelf() {
ReflectionTestUtils.setField(FlexLogger.class, "loggerType", LoggerType.EELF);
Logger logger = FlexLogger.getLogger(true);
assertSame(logger, FlexLogger.getLogger(true));
}
@Test
- public void testGetLoggerStringBooleanSystemOut() {
+ void testGetLoggerStringBooleanSystemOut() {
ReflectionTestUtils.setField(FlexLogger.class, "loggerType", LoggerType.SYSTEMOUT);
Logger logger = FlexLogger.getLogger(true);
assertSame(logger, FlexLogger.getLogger(true));
}
@Test
- public void testGetClassName() {
+ void testGetClassName() {
assertNotEquals("FlexLogger", new FlexLogger().getClassName());
}
@Test
- public void testPropertiesCallBack() throws IOException {
+ void testPropertiesCallBack() {
Set<String> changedKeys = new HashSet<>();
changedKeys.add("debugLogger.level");
changedKeys.add("metricsLogger.level");
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/PropertyUtilTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/PropertyUtilTest.java
index 13f525c9..75c512b2 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/PropertyUtilTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/PropertyUtilTest.java
@@ -3,7 +3,7 @@
* ONAP-Logging
* ================================================================================
* Copyright (C) 2018-2020 Ericsson, AT&T. All rights reserved.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2023-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,9 +21,9 @@
package org.onap.policy.common.logging.flexlogger;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.doAnswer;
@@ -38,15 +38,15 @@ import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.logging.flexlogger.PropertyUtil.Listener;
import org.springframework.test.util.ReflectionTestUtils;
-public class PropertyUtilTest {
+class PropertyUtilTest {
private static final String TIMER_FIELD = "timer";
private static final File FILE = new File("target/test.properties");
@@ -56,13 +56,13 @@ public class PropertyUtilTest {
private Timer timer;
private TestListener testListener;
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() {
saveTimer = (Timer) ReflectionTestUtils.getField(PropertyUtil.LazyHolder.class, TIMER_FIELD);
}
- @AfterClass
+ @AfterAll
public static void tearDownAfterClass() {
ReflectionTestUtils.setField(PropertyUtil.LazyHolder.class, TIMER_FIELD, saveTimer);
@@ -71,8 +71,8 @@ public class PropertyUtilTest {
/**
* Perform test case set up.
*/
- @Before
- public void setUp() throws IOException {
+ @BeforeEach
+ void setUp() throws IOException {
task = null;
timer = mock(Timer.class);
ReflectionTestUtils.setField(PropertyUtil.LazyHolder.class, TIMER_FIELD, timer);
@@ -91,19 +91,19 @@ public class PropertyUtilTest {
fileOutputStream.close();
}
- @After
- public void tearDown() throws IOException {
+ @AfterEach
+ void tearDown() throws IOException {
PropertyUtil.stopListening(FILE, testListener);
FILE.delete();
}
@Test
- public void testTimer() {
+ void testTimer() {
assertNotNull(saveTimer);
}
@Test
- public void testGetProperties() throws IOException {
+ void testGetProperties() throws IOException {
FileOutputStream fileOutputStream = new FileOutputStream(FILE);
Properties properties = new Properties();
properties.put("testProperty", "testValue");
@@ -115,7 +115,7 @@ public class PropertyUtilTest {
}
@Test
- public void testPropertiesChanged() throws IOException, InterruptedException {
+ void testPropertiesChanged() throws IOException, InterruptedException {
PropertyUtil.getProperties(FILE, testListener);
FileOutputStream fileOutputStream = new FileOutputStream(FILE);
@@ -130,7 +130,7 @@ public class PropertyUtilTest {
}
@Test
- public void testStopListening() throws IOException {
+ void testStopListening() throws IOException {
FileOutputStream fileOutputStream = new FileOutputStream(FILE);
Properties properties = new Properties();
properties.put("testProperty", "testValue");
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/SystemOutLoggerTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/SystemOutLoggerTest.java
index 38c9e0d2..343eea9c 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/SystemOutLoggerTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/SystemOutLoggerTest.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,35 +23,35 @@
package org.onap.policy.common.logging.flexlogger;
import static org.assertj.core.api.Assertions.assertThatCode;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import com.att.eelf.configuration.EELFLogger.Level;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.UUID;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.logging.eelf.MessageCodes;
import org.onap.policy.common.logging.eelf.PolicyLogger;
-public class SystemOutLoggerTest {
+class SystemOutLoggerTest {
SystemOutLogger systemOutLogger = new SystemOutLogger("SystemOutLoggerTest");
@Test
- public void testSystemOutLoggerClassOfQ() {
+ void testSystemOutLoggerClassOfQ() {
assertThatCode(() -> new SystemOutLogger(SystemOutLoggerTest.class)).doesNotThrowAnyException();
}
@Test
- public void testSetAndGetTransId() {
+ void testSetAndGetTransId() {
systemOutLogger.setTransId("transactionId");
assertEquals("transactionId", systemOutLogger.getTransId());
}
@Test
- public void testDebugObject() {
+ void testDebugObject() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -66,7 +67,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testErrorObject() {
+ void testErrorObject() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -82,7 +83,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testInfoObject() {
+ void testInfoObject() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -98,7 +99,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testWarnObject() {
+ void testWarnObject() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -114,7 +115,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testTraceObject() {
+ void testTraceObject() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -130,7 +131,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testIsDebugEnabled() {
+ void testIsDebugEnabled() {
PolicyLogger.setDebugLevel(Level.DEBUG);
systemOutLogger = new SystemOutLogger("SystemOutLoggerTest");
assertTrue(systemOutLogger.isDebugEnabled());
@@ -140,7 +141,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testIsWarnEnabled() {
+ void testIsWarnEnabled() {
PolicyLogger.setDebugLevel(Level.WARN);
systemOutLogger = new SystemOutLogger("SystemOutLoggerTest");
assertTrue(systemOutLogger.isWarnEnabled());
@@ -150,7 +151,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testIsInfoEnabled() {
+ void testIsInfoEnabled() {
PolicyLogger.setDebugLevel(Level.INFO);
systemOutLogger = new SystemOutLogger("SystemOutLoggerTest");
assertTrue(systemOutLogger.isInfoEnabled());
@@ -160,7 +161,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testIsErrorEnabled() {
+ void testIsErrorEnabled() {
PolicyLogger.setErrorLevel(Level.ERROR);
systemOutLogger = new SystemOutLogger("SystemOutLoggerTest");
assertTrue(systemOutLogger.isErrorEnabled());
@@ -170,7 +171,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testIsAuditEnabled() {
+ void testIsAuditEnabled() {
PolicyLogger.setAuditLevel(Level.INFO);
systemOutLogger = new SystemOutLogger("SystemOutLoggerTest");
assertTrue(systemOutLogger.isAuditEnabled());
@@ -180,7 +181,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testIsMetricsEnabled() {
+ void testIsMetricsEnabled() {
PolicyLogger.setMetricsLevel(Level.INFO);
systemOutLogger = new SystemOutLogger("SystemOutLoggerTest");
assertTrue(systemOutLogger.isMetricsEnabled());
@@ -190,7 +191,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testAuditObject() {
+ void testAuditObject() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -206,7 +207,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testRecordAuditEventStartString() {
+ void testRecordAuditEventStartString() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -222,7 +223,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testRecordAuditEventStartUuid() {
+ void testRecordAuditEventStartUuid() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -238,7 +239,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testRecordAuditEventEndStringStringString() {
+ void testRecordAuditEventEndStringStringString() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -253,7 +254,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testRecordAuditEventEndUuidStringString() {
+ void testRecordAuditEventEndUuidStringString() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -269,7 +270,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testRecordAuditEventEndStringString() {
+ void testRecordAuditEventEndStringString() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -284,7 +285,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testRecordAuditEventEndUuidString() {
+ void testRecordAuditEventEndUuidString() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -300,14 +301,14 @@ public class SystemOutLoggerTest {
}
@Test
- public void testRecordMetricEventStringString() {
+ void testRecordMetricEventStringString() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
try {
System.setOut(ps);
systemOutLogger.recordMetricEvent("eventId", "rule");
- assertTrue(baos.toString(), baos.toString().contains("SystemOutLoggerTest : eventId:eventIdmessage:rule"));
+ assertTrue(baos.toString().contains("SystemOutLoggerTest : eventId:eventIdmessage:rule"), baos.toString());
} finally {
System.out.flush();
System.setOut(old);
@@ -315,7 +316,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testRecordMetricEventUuidString() {
+ void testRecordMetricEventUuidString() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -331,7 +332,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testMetrics() {
+ void testMetrics() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -346,7 +347,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testErrorMessageCodesThrowableStringArray() {
+ void testErrorMessageCodesThrowableStringArray() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -362,7 +363,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testErrorMessageCodesStringArray() {
+ void testErrorMessageCodesStringArray() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -379,12 +380,12 @@ public class SystemOutLoggerTest {
}
@Test
- public void testPostMdcInfoForEventString() {
+ void testPostMdcInfoForEventString() {
assertEquals("transactionId", systemOutLogger.postMdcInfoForEvent("transactionId"));
}
@Test
- public void testWarnMessageCodesStringArray() {
+ void testWarnMessageCodesStringArray() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -401,7 +402,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testWarnMessageCodesThrowableStringArray() {
+ void testWarnMessageCodesThrowableStringArray() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -418,7 +419,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testDebugObjectThrowable() {
+ void testDebugObjectThrowable() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -426,8 +427,8 @@ public class SystemOutLoggerTest {
System.setOut(ps);
systemOutLogger.setTransId("transactionId");
systemOutLogger.debug("1", new NullPointerException());
- assertTrue(baos.toString(),
- baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"));
+ assertTrue(baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"),
+ baos.toString());
} finally {
System.out.flush();
System.setOut(old);
@@ -435,7 +436,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testErrorObjectThrowable() {
+ void testErrorObjectThrowable() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -443,8 +444,8 @@ public class SystemOutLoggerTest {
System.setOut(ps);
systemOutLogger.setTransId("transactionId");
systemOutLogger.error("1", new NullPointerException());
- assertTrue(baos.toString(),
- baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"));
+ assertTrue(baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"),
+ baos.toString());
} finally {
System.out.flush();
System.setOut(old);
@@ -452,7 +453,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testInfoObjectThrowable() {
+ void testInfoObjectThrowable() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -460,8 +461,8 @@ public class SystemOutLoggerTest {
System.setOut(ps);
systemOutLogger.setTransId("transactionId");
systemOutLogger.info("1", new NullPointerException());
- assertTrue(baos.toString(),
- baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"));
+ assertTrue(baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"),
+ baos.toString());
} finally {
System.out.flush();
System.setOut(old);
@@ -469,7 +470,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testWarnObjectThrowable() {
+ void testWarnObjectThrowable() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -477,8 +478,8 @@ public class SystemOutLoggerTest {
System.setOut(ps);
systemOutLogger.setTransId("transactionId");
systemOutLogger.warn("1", new NullPointerException());
- assertTrue(baos.toString(),
- baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"));
+ assertTrue(baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"),
+ baos.toString());
} finally {
System.out.flush();
System.setOut(old);
@@ -486,7 +487,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testTraceObjectThrowable() {
+ void testTraceObjectThrowable() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -494,8 +495,8 @@ public class SystemOutLoggerTest {
System.setOut(ps);
systemOutLogger.setTransId("transactionId");
systemOutLogger.trace(1, new NullPointerException());
- assertTrue(baos.toString(),
- baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"));
+ assertTrue(baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"),
+ baos.toString());
} finally {
System.out.flush();
System.setOut(old);
@@ -503,7 +504,7 @@ public class SystemOutLoggerTest {
}
@Test
- public void testAuditObjectThrowable() {
+ void testAuditObjectThrowable() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
@@ -511,8 +512,8 @@ public class SystemOutLoggerTest {
System.setOut(ps);
systemOutLogger.setTransId("transactionId");
systemOutLogger.audit("1", new NullPointerException());
- assertTrue(baos.toString(),
- baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"));
+ assertTrue(baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"),
+ baos.toString());
} finally {
System.out.flush();
System.setOut(old);
@@ -520,19 +521,19 @@ public class SystemOutLoggerTest {
}
@Test
- public void testIsTraceEnabled() {
+ void testIsTraceEnabled() {
assertFalse(systemOutLogger.isTraceEnabled());
}
@Test
- public void testPostMdcInfoForTriggeredRule() {
+ void testPostMdcInfoForTriggeredRule() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
try {
System.setOut(ps);
systemOutLogger.postMdcInfoForTriggeredRule("transactionId");
- assertTrue(baos.toString(), baos.toString().contains("transactionId"));
+ assertTrue(baos.toString().contains("transactionId"), baos.toString());
} finally {
System.out.flush();
System.setOut(old);
@@ -540,14 +541,14 @@ public class SystemOutLoggerTest {
}
@Test
- public void testPostMdcInfoForEventObject() {
+ void testPostMdcInfoForEventObject() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
try {
System.setOut(ps);
systemOutLogger.postMdcInfoForEvent(1);
- assertTrue(baos.toString(), baos.toString().contains("1"));
+ assertTrue(baos.toString().contains("1"), baos.toString());
} finally {
System.out.flush();
System.setOut(old);