diff options
Diffstat (limited to 'aai-els-onap-logging')
32 files changed, 134 insertions, 135 deletions
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/RequestError.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/RequestError.java index 96602906..6d3a6501 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/RequestError.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/RequestError.java @@ -21,7 +21,6 @@ package org.onap.aai.domain.errorResponse; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; -import lombok.Value; import java.util.Map; @NoArgsConstructor diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/exceptions/AAIException.java b/aai-els-onap-logging/src/main/java/org/onap/aai/exceptions/AAIException.java index e302cd5a..6c30dd07 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/exceptions/AAIException.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/exceptions/AAIException.java @@ -28,7 +28,6 @@ import java.util.LinkedList; import org.onap.aai.logging.ErrorLogHelper; import org.onap.aai.logging.ErrorObject; -import org.onap.aai.logging.ErrorObjectNotFoundException; public class AAIException extends Exception { diff --git a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AuditLogContainerFilter.java b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AuditLogContainerFilter.java index 530d53b3..270f786e 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AuditLogContainerFilter.java +++ b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AuditLogContainerFilter.java @@ -24,7 +24,10 @@ import java.io.IOException; import javax.annotation.Priority; import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.container.*; +import javax.ws.rs.container.ContainerRequestContext; +import javax.ws.rs.container.ContainerRequestFilter; +import javax.ws.rs.container.ContainerResponseContext; +import javax.ws.rs.container.ContainerResponseFilter; import javax.ws.rs.core.Context; import javax.ws.rs.ext.Providers; diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/aailog/filter/AaiAuditLogContainerFilterTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/aailog/filter/AaiAuditLogContainerFilterTest.java index 246586d0..fd770347 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/aailog/filter/AaiAuditLogContainerFilterTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/aailog/filter/AaiAuditLogContainerFilterTest.java @@ -20,7 +20,7 @@ package org.onap.aai.aailog.filter; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.when; import java.net.URI; @@ -31,18 +31,18 @@ import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.UriInfo; -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.onap.logging.filter.base.Constants; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.MDC; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AaiAuditLogContainerFilterTest { @Mock private ContainerRequestContext containerRequest; @@ -57,7 +57,7 @@ public class AaiAuditLogContainerFilterTest { @InjectMocks private AaiAuditLogContainerFilter aaiAuditFilter; - @After + @AfterEach public void tearDown() { MDC.clear(); } diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/aailog/filter/RestClientLoggingInterceptorTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/aailog/filter/RestClientLoggingInterceptorTest.java index f8d23f39..53e87509 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/aailog/filter/RestClientLoggingInterceptorTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/aailog/filter/RestClientLoggingInterceptorTest.java @@ -20,8 +20,8 @@ package org.onap.aai.aailog.filter; -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 static org.mockito.Mockito.doReturn; import java.net.InetAddress; @@ -29,20 +29,20 @@ import java.net.URI; import java.net.URISyntaxException; import java.net.UnknownHostException; -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.onap.logging.filter.base.Constants; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.MDC; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpRequest; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class RestClientLoggingInterceptorTest { @Mock @@ -52,7 +52,7 @@ public class RestClientLoggingInterceptorTest { @InjectMocks private RestClientLoggingInterceptor restClientLoggingInterceptor; - @After + @AfterEach public void tearDown() { MDC.clear(); } diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/aailog/filter/RestControllerClientLoggingInterceptorTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/aailog/filter/RestControllerClientLoggingInterceptorTest.java index 84e032d8..006b3c4a 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/aailog/filter/RestControllerClientLoggingInterceptorTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/aailog/filter/RestControllerClientLoggingInterceptorTest.java @@ -38,7 +38,6 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; -import org.mockito.Mock; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; import org.onap.logging.filter.base.Constants; diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/exceptions/AAIExceptionTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/exceptions/AAIExceptionTest.java index b489a0ab..5d7b989d 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/exceptions/AAIExceptionTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/exceptions/AAIExceptionTest.java @@ -20,14 +20,14 @@ package org.onap.aai.exceptions; -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 java.io.IOException; import javax.ws.rs.core.Response; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.onap.aai.logging.AaiElsErrorCode; import org.onap.aai.logging.ErrorObject; diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/exceptions/AAIExceptionWithInfoTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/exceptions/AAIExceptionWithInfoTest.java index 84284ec5..282dcfa3 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/exceptions/AAIExceptionWithInfoTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/exceptions/AAIExceptionWithInfoTest.java @@ -20,13 +20,13 @@ package org.onap.aai.exceptions; -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 java.io.IOException; import java.util.HashMap; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class AAIExceptionWithInfoTest { diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/CNNameTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/CNNameTest.java index d95aefa0..906bd5db 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/CNNameTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/CNNameTest.java @@ -20,7 +20,7 @@ package org.onap.aai.logging; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.when; import ch.qos.logback.access.spi.IAccessEvent; @@ -29,16 +29,16 @@ import java.security.cert.X509Certificate; import javax.security.auth.x500.X500Principal; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class CNNameTest { @Mock X509Certificate cert; @@ -50,7 +50,7 @@ public class CNNameTest { @InjectMocks private CNName cnName; - @Before + @BeforeEach public void setup() { when(cnName.isStarted()).thenReturn(true); } diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/CustomLogPatternLayoutTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/CustomLogPatternLayoutTest.java index 28be0bf0..6a39a4b7 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/CustomLogPatternLayoutTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/CustomLogPatternLayoutTest.java @@ -20,9 +20,9 @@ package org.onap.aai.logging; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CustomLogPatternLayoutTest { diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/DME2RestFlagTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/DME2RestFlagTest.java index c29e29d6..ddd0c6db 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/DME2RestFlagTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/DME2RestFlagTest.java @@ -20,20 +20,20 @@ package org.onap.aai.logging; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.when; import ch.qos.logback.access.spi.IAccessEvent; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DME2RestFlagTest { @Mock @@ -43,7 +43,7 @@ public class DME2RestFlagTest { @InjectMocks private DME2RestFlag dme2RestFlag; - @Before + @BeforeEach public void setup() { when(dme2RestFlag.isStarted()).thenReturn(true); } diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorLogHelperTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorLogHelperTest.java index 73890a0a..226e4b22 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorLogHelperTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorLogHelperTest.java @@ -22,7 +22,7 @@ package org.onap.aai.logging; import static java.lang.Thread.sleep; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import java.io.IOException; import java.util.ArrayList; @@ -34,10 +34,9 @@ import java.util.Map; import javax.ws.rs.core.MediaType; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.aai.domain.errorResponse.ErrorMessage; import org.onap.aai.domain.errorResponse.ExceptionType; import org.onap.aai.domain.errorResponse.Fault; @@ -59,12 +58,12 @@ public class ErrorLogHelperTest { private static final ObjectMapper objectMapper = new ObjectMapper(); private static final XmlMapper xmlMapper = new XmlMapper(); - @Before + @BeforeEach public void init() { System.setProperty("AJSC_HOME", "."); } - @After + @AfterEach public void cleanup() throws IOException { MDC.clear(); LogFile.deleteContents(errorLogFileName); diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorObjectFormatExceptionTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorObjectFormatExceptionTest.java index 97934723..bcf35885 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorObjectFormatExceptionTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorObjectFormatExceptionTest.java @@ -20,9 +20,9 @@ package org.onap.aai.logging; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ErrorObjectFormatExceptionTest { diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorObjectNotFoundExceptionTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorObjectNotFoundExceptionTest.java index 6be89425..6b832c2f 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorObjectNotFoundExceptionTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorObjectNotFoundExceptionTest.java @@ -20,11 +20,11 @@ package org.onap.aai.logging; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import java.io.IOException; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ErrorObjectNotFoundExceptionTest { diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorObjectTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorObjectTest.java index a281ba56..6c2b12e0 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorObjectTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorObjectTest.java @@ -20,11 +20,11 @@ package org.onap.aai.logging; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import javax.ws.rs.core.Response; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ErrorObjectTest { private ErrorObject errorObject; diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/LogFormatToolsTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/LogFormatToolsTest.java index b352cb14..d580efa1 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/LogFormatToolsTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/LogFormatToolsTest.java @@ -20,10 +20,10 @@ package org.onap.aai.logging; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.onap.aai.exceptions.AAIException; public class LogFormatToolsTest { diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/LoggingContextTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/LoggingContextTest.java index d793eb77..650f94b7 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/LoggingContextTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/LoggingContextTest.java @@ -20,17 +20,17 @@ package org.onap.aai.logging; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import java.util.concurrent.TimeUnit; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.slf4j.MDC; public class LoggingContextTest { - @After + @AfterEach public void cleanup() { MDC.clear(); } diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/StopWatchNotStartedExceptionTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/StopWatchNotStartedExceptionTest.java index 2c9c52c5..6833942a 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/StopWatchNotStartedExceptionTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/StopWatchNotStartedExceptionTest.java @@ -20,10 +20,10 @@ package org.onap.aai.logging; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class StopWatchNotStartedExceptionTest { diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/StopWatchTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/StopWatchTest.java index 34aecd56..9893bb2b 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/StopWatchTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/StopWatchTest.java @@ -21,15 +21,15 @@ package org.onap.aai.logging; import static java.lang.Thread.sleep; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.slf4j.MDC; public class StopWatchTest { - @After + @AfterEach public void cleanup() { MDC.clear(); } diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/util/AAIApplicationConfigTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/util/AAIApplicationConfigTest.java index 7d51ccc2..242e3441 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/util/AAIApplicationConfigTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/util/AAIApplicationConfigTest.java @@ -22,16 +22,16 @@ package org.onap.aai.util; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.aai.exceptions.AAIException; public class AAIApplicationConfigTest { - @Before + @BeforeEach public void setup() { AAIApplicationConfig.init(); } diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/util/AAIConfigTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/util/AAIConfigTest.java index dad8c351..7073c841 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/util/AAIConfigTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/util/AAIConfigTest.java @@ -22,15 +22,15 @@ package org.onap.aai.util; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.aai.exceptions.AAIException; public class AAIConfigTest { - @Before + @BeforeEach public void setup() throws AAIException { AAIConfig.init(); } diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/util/FormatDateTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/util/FormatDateTest.java index b1be62a1..4041f00d 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/util/FormatDateTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/util/FormatDateTest.java @@ -22,9 +22,9 @@ package org.onap.aai.util; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.onap.aai.exceptions.AAIException; public class FormatDateTest { diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/util/MapperUtilTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/util/MapperUtilTest.java index 14d80020..309e4a49 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/util/MapperUtilTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/util/MapperUtilTest.java @@ -22,19 +22,19 @@ package org.onap.aai.util; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.json.JSONObject; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class MapperUtilTest { private JSONObject expectedJson; private JSONObject sampleJson; - @Before + @BeforeEach public void setup() { expectedJson = new JSONObject(); sampleJson = new JSONObject(); @@ -45,7 +45,7 @@ public class MapperUtilTest { expectedJson.put("color", "black"); expectedJson.put("shape", "box"); SampleClass sample = new SampleClass("black", "box"); - Assert.assertEquals(expectedJson.toString(), MapperUtil.writeAsJSONString(sample)); + Assertions.assertEquals(expectedJson.toString(), MapperUtil.writeAsJSONString(sample)); } @Test diff --git a/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/AuditLogContainerFilterTest.java b/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/AuditLogContainerFilterTest.java index 8ac9f12d..a8903c41 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/AuditLogContainerFilterTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/AuditLogContainerFilterTest.java @@ -20,7 +20,7 @@ package org.onap.logging.filter.base; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.when; import javax.ws.rs.container.ContainerRequestContext; @@ -29,19 +29,19 @@ import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.UriInfo; -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AuditLogContainerFilterTest { protected static final Logger logger = LoggerFactory.getLogger(AbstractMetricLogFilter.class); @@ -58,7 +58,7 @@ public class AuditLogContainerFilterTest { @InjectMocks private AuditLogContainerFilter auditLogContainerFilter; - @After + @AfterEach public void tearDown() { MDC.clear(); } diff --git a/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/AuditLogServletFilterTest.java b/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/AuditLogServletFilterTest.java index afdfe059..6f724a09 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/AuditLogServletFilterTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/AuditLogServletFilterTest.java @@ -20,7 +20,7 @@ package org.onap.logging.filter.base; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.when; import javax.servlet.ServletRequest; @@ -28,17 +28,17 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.MDC; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AuditLogServletFilterTest { @Mock @@ -57,7 +57,7 @@ public class AuditLogServletFilterTest { @InjectMocks private AuditLogServletFilter auditLogServletFilter; - @After + @AfterEach public void tearDown() { MDC.clear(); } diff --git a/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/LoggingContainerFilterTest.java b/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/LoggingContainerFilterTest.java index 6390c8ea..defc7855 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/LoggingContainerFilterTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/LoggingContainerFilterTest.java @@ -20,12 +20,12 @@ package org.onap.logging.filter.base; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.onap.logging.ref.slf4j.ONAPLogConstants; public class LoggingContainerFilterTest { diff --git a/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/MDCSetupTest.java b/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/MDCSetupTest.java index e47db8ce..e3245fa9 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/MDCSetupTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/MDCSetupTest.java @@ -20,9 +20,7 @@ package org.onap.logging.filter.base; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.when; import java.util.HashMap; @@ -32,15 +30,15 @@ import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.MDC; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class MDCSetupTest extends MDCSetup { @Mock @@ -49,7 +47,7 @@ public class MDCSetupTest extends MDCSetup { private String requestId = "4d31fe02-4918-4975-942f-fe51a44e6a9b"; private String invocationId = "4d31fe02-4918-4975-942f-fe51a44e6a9a"; - @After + @AfterEach public void tearDown() { MDC.clear(); System.clearProperty("partnerName"); diff --git a/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/MetricLogClientFilterTest.java b/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/MetricLogClientFilterTest.java index daa57625..6f23d9b5 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/MetricLogClientFilterTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/MetricLogClientFilterTest.java @@ -20,8 +20,8 @@ package org.onap.logging.filter.base; -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 static org.mockito.Mockito.doReturn; import java.net.URI; @@ -34,17 +34,17 @@ import javax.ws.rs.client.ClientRequestContext; import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.MDC; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class MetricLogClientFilterTest { @Mock private ClientRequestContext clientRequest; @@ -53,7 +53,7 @@ public class MetricLogClientFilterTest { @InjectMocks private MetricLogClientFilter metricLogClientFilter; - @After + @AfterEach public void tearDown() { MDC.clear(); } diff --git a/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/PayloadLoggingClientFilterTest.java b/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/PayloadLoggingClientFilterTest.java index 61e7014b..74463a7b 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/PayloadLoggingClientFilterTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/PayloadLoggingClientFilterTest.java @@ -20,7 +20,7 @@ package org.onap.logging.filter.base; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.when; import java.io.IOException; @@ -30,14 +30,14 @@ import javax.ws.rs.client.ClientRequestContext; import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class PayloadLoggingClientFilterTest { @Mock diff --git a/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/SimpleJaxrsHeadersMapTest.java b/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/SimpleJaxrsHeadersMapTest.java index 0ae919fc..660bd3ce 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/SimpleJaxrsHeadersMapTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/SimpleJaxrsHeadersMapTest.java @@ -20,12 +20,12 @@ package org.onap.logging.filter.base; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.onap.logging.ref.slf4j.ONAPLogConstants; public class SimpleJaxrsHeadersMapTest { diff --git a/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/SimpleServletHeadersMapTest.java b/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/SimpleServletHeadersMapTest.java index ccde0000..c2a271a7 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/SimpleServletHeadersMapTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/SimpleServletHeadersMapTest.java @@ -20,19 +20,19 @@ package org.onap.logging.filter.base; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.when; import javax.servlet.http.HttpServletRequest; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SimpleServletHeadersMapTest { @Mock diff --git a/aai-els-onap-logging/src/test/java/org/onap/logging/ref/slf4j/ONAPLogAdapterTest.java b/aai-els-onap-logging/src/test/java/org/onap/logging/ref/slf4j/ONAPLogAdapterTest.java index f0553603..f3d0ed95 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/logging/ref/slf4j/ONAPLogAdapterTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/logging/ref/slf4j/ONAPLogAdapterTest.java @@ -29,6 +29,7 @@ import static org.hamcrest.core.IsNull.nullValue; import static org.hamcrest.core.IsSame.sameInstance; import static org.hamcrest.core.StringEndsWith.endsWith; import static org.hamcrest.number.OrderingComparison.lessThan; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.util.HashMap; import java.util.Map; @@ -36,8 +37,8 @@ import java.util.UUID; import javax.xml.bind.DatatypeConverter; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; @@ -52,7 +53,7 @@ public class ONAPLogAdapterTest { /** * Ensure that MDCs are cleared after each testcase. */ - @After + @AfterEach public void resetMDCs() { MDC.clear(); } @@ -60,10 +61,11 @@ public class ONAPLogAdapterTest { /** * Test nullcheck. */ - @Test(expected = NullPointerException.class) + @Test public void testCheckNotNull() { + assertThrows(NullPointerException.class, () -> - ONAPLogAdapter.checkNotNull(null); + ONAPLogAdapter.checkNotNull(null)); } /** |