summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2024-06-17 15:31:12 +0100
committeradheli.tavares <adheli.tavares@est.tech>2024-06-17 16:05:42 +0100
commitfe6bb57982677177f85daa5f893868556b18e63c (patch)
tree54a2f6f5a3e31469c4ea703a777399fb30fc9cfc /plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src
parente9b746340711ddfccee7ac0f669ace626b1b3d46 (diff)
Convert junit4 to junit5
- plugins module Issue-ID: POLICY-5041 Change-Id: Iebff0a2e6898a5dfe9679662dd2be4c5067a4008 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src')
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/AccessControlFilterTest.java20
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumerTest.java110
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerProducerTest.java74
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/RestServerCarrierTechnologyParametersTest.java29
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/SupportApexEventReceiver.java2
5 files changed, 122 insertions, 113 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/AccessControlFilterTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/AccessControlFilterTest.java
index 1ec0d52bb..b2e158f1a 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/AccessControlFilterTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/AccessControlFilterTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021, 2023 Nordix Foundation.
+ * Copyright (C) 2021, 2023-2024 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,7 +21,7 @@
package org.onap.policy.apex.plugins.event.carrier.restserver;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import jakarta.ws.rs.container.ContainerRequestContext;
import jakarta.ws.rs.container.ContainerResponseContext;
@@ -29,16 +29,16 @@ import jakarta.ws.rs.core.MultivaluedHashMap;
import jakarta.ws.rs.core.MultivaluedMap;
import java.io.IOException;
import org.apache.commons.lang3.RandomStringUtils;
-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.Mock;
import org.mockito.Mockito;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
-@RunWith(MockitoJUnitRunner.class)
-public class AccessControlFilterTest {
+@ExtendWith(MockitoExtension.class)
+class AccessControlFilterTest {
private AccessControlFilter acf;
@@ -47,13 +47,13 @@ public class AccessControlFilterTest {
@Mock
private ContainerResponseContext responseContext;
- @Before
+ @BeforeEach
public void beforeEach() {
acf = new AccessControlFilter();
}
@Test
- public void filterAddToExisting() throws IOException {
+ void filterAddToExisting() throws IOException {
// prepare mocks
final String origin = RandomStringUtils.randomAlphanumeric(14, 16);
final MultivaluedHashMap<String, Object> map = new MultivaluedHashMap<>();
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumerTest.java
index 5f7cb257b..291a97c70 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumerTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumerTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Samsung. All rights reserved.
- * Modifications Copyright (C) 2019-2021, 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2021, 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,84 +21,84 @@
package org.onap.policy.apex.plugins.event.carrier.restserver;
-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.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import jakarta.ws.rs.core.Response;
import java.io.IOException;
import java.lang.reflect.Field;
-import org.junit.After;
-import org.junit.Before;
-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.policy.apex.service.engine.event.ApexEventException;
import org.onap.policy.apex.service.engine.event.ApexEventReceiver;
import org.onap.policy.apex.service.engine.event.ApexPluginsEventConsumer;
import org.onap.policy.apex.service.engine.event.PeeredReference;
-import org.onap.policy.apex.service.engine.event.SynchronousEventCache;
import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters;
import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters;
import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode;
import org.onap.policy.common.endpoints.http.server.HttpServletServer;
import org.onap.policy.common.utils.network.NetworkUtil;
-public class ApexRestServerConsumerTest {
+class ApexRestServerConsumerTest {
ApexRestServerConsumer apexRestServerConsumer = null;
EventHandlerParameters consumerParameters = null;
ApexEventReceiver incomingEventReceiver = null;
ApexRestServerProducer apexRestServerProducer = null;
RestServerCarrierTechnologyParameters restServerCarrierTechnologyParameters = null;
- SynchronousEventCache synchronousEventCache = null;
+
+ AutoCloseable closeable;
/**
* Set up testing.
- *
- * @throws Exception on test set up errors.
*/
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() {
apexRestServerConsumer = new ApexRestServerConsumer();
consumerParameters = new EventHandlerParameters();
apexRestServerProducer = new ApexRestServerProducer();
apexRestServerConsumer.start();
}
- @After
- public void tearDown() {
+ @AfterEach
+ void tearDown() {
apexRestServerConsumer.stop();
}
- @Test(expected = ApexEventException.class)
- public void testInitWithNonWebSocketCarrierTechnologyParameters() throws ApexEventException {
- consumerParameters.setCarrierTechnologyParameters(new CarrierTechnologyParameters() {});
- apexRestServerConsumer.init("TestApexRestServerConsumer", consumerParameters,
- incomingEventReceiver);
+ @Test
+ void testInitWithNonWebSocketCarrierTechnologyParameters() {
+ consumerParameters.setCarrierTechnologyParameters(new CarrierTechnologyParameters() {
+ });
+ assertThrows(ApexEventException.class, () ->
+ apexRestServerConsumer.init("TestApexRestServerConsumer", consumerParameters, incomingEventReceiver));
}
- @Test(expected = ApexEventException.class)
- public void testInitWithWebSocketCarrierTechnologyParameters() throws ApexEventException {
+ @Test
+ void testInitWithWebSocketCarrierTechnologyParameters() {
restServerCarrierTechnologyParameters = new RestServerCarrierTechnologyParameters();
consumerParameters.setCarrierTechnologyParameters(restServerCarrierTechnologyParameters);
- apexRestServerConsumer.init("TestApexRestServerConsumer", consumerParameters,
- incomingEventReceiver);
+ assertThrows(ApexEventException.class, () ->
+ apexRestServerConsumer.init("TestApexRestServerConsumer", consumerParameters, incomingEventReceiver));
}
- @Test(expected = ApexEventException.class)
- public void testInitWithSynchronousMode() throws ApexEventException, SecurityException, IllegalArgumentException {
+ @Test
+ void testInitWithSynchronousMode() throws SecurityException, IllegalArgumentException {
restServerCarrierTechnologyParameters = new RestServerCarrierTechnologyParameters();
restServerCarrierTechnologyParameters.setStandalone(true);
consumerParameters.setCarrierTechnologyParameters(restServerCarrierTechnologyParameters);
consumerParameters.setPeeredMode(EventHandlerPeeredMode.SYNCHRONOUS, true);
- apexRestServerConsumer.init("TestApexRestServerConsumer", consumerParameters,
- incomingEventReceiver);
+
+ assertThrows(ApexEventException.class, () -> apexRestServerConsumer.init("TestApexRestServerConsumer",
+ consumerParameters, incomingEventReceiver));
}
- @Test(expected = IllegalArgumentException.class)
- public void testInitWithSynchronousModeAndProperValues()
- throws ApexEventException, SecurityException, IllegalArgumentException {
+ @Test
+ void testInitWithSynchronousModeAndProperValues() throws SecurityException, IllegalArgumentException {
restServerCarrierTechnologyParameters = new RestServerCarrierTechnologyParameters();
@@ -109,12 +109,14 @@ public class ApexRestServerConsumerTest {
consumerParameters.setCarrierTechnologyParameters(restServerCarrierTechnologyParameters);
consumerParameters.setPeeredMode(EventHandlerPeeredMode.SYNCHRONOUS, true);
- apexRestServerConsumer.init("TestApexRestServerConsumer", consumerParameters,
- incomingEventReceiver);
+
+ assertThrows(IllegalArgumentException.class,
+ () -> apexRestServerConsumer.init("TestApexRestServerConsumer", consumerParameters,
+ incomingEventReceiver));
}
@Test
- public void testInitAndStop() throws ApexEventException, IOException {
+ void testInitAndStop() throws ApexEventException, IOException {
restServerCarrierTechnologyParameters = new RestServerCarrierTechnologyParameters();
restServerCarrierTechnologyParameters.setStandalone(true);
@@ -138,39 +140,39 @@ public class ApexRestServerConsumerTest {
}
@Test
- public void testGetName() {
+ void testGetName() {
assertNull(apexRestServerConsumer.getName());
}
@Test
- public void testGetPeeredReference() {
+ void testGetPeeredReference() {
assertNull(apexRestServerConsumer.getPeeredReference(EventHandlerPeeredMode.REQUESTOR));
}
@Test
- public void testSetPeeredReference() {
+ void testSetPeeredReference() {
PeeredReference peeredReference = new PeeredReference(EventHandlerPeeredMode.REQUESTOR,
- apexRestServerConsumer, apexRestServerProducer);
+ apexRestServerConsumer, apexRestServerProducer);
apexRestServerConsumer.setPeeredReference(EventHandlerPeeredMode.REQUESTOR,
- peeredReference);
+ peeredReference);
assertNotNull(apexRestServerConsumer.getPeeredReference(EventHandlerPeeredMode.REQUESTOR));
}
@Test
- public void testReceiveEvent() throws ApexEventException {
+ void testReceiveEvent() {
Response response = apexRestServerConsumer.receiveEvent("");
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatus());
+ response.close();
}
- @Test(expected = NullPointerException.class)
- public void testReceiveEventWithNonDefaultValues()
- throws ApexEventException, NoSuchFieldException, SecurityException,
- IllegalArgumentException, IllegalAccessException {
+ @Test
+ void testReceiveEventWithNonDefaultValues() throws NoSuchFieldException, SecurityException,
+ IllegalArgumentException, IllegalAccessException {
PeeredReference peeredReference = new PeeredReference(EventHandlerPeeredMode.REQUESTOR,
- apexRestServerConsumer, apexRestServerProducer);
+ apexRestServerConsumer, apexRestServerProducer);
apexRestServerConsumer.setPeeredReference(EventHandlerPeeredMode.REQUESTOR,
- peeredReference);
+ peeredReference);
ApexEventReceiver apexEventReceiver = new SupportApexEventReceiver();
@@ -178,8 +180,14 @@ public class ApexRestServerConsumerTest {
Field field = ApexPluginsEventConsumer.class.getDeclaredField("name");
field.setAccessible(true);
field.set(apexRestServerConsumer, "TestApexRestServerConsumer");
+ assertThrows(NullPointerException.class, () ->
+ closeable = apexRestServerConsumer.receiveEvent("TestApexRestServerConsumer"));
+ }
- apexRestServerConsumer.receiveEvent("TestApexRestServerConsumer");
-
+ @AfterEach
+ void after() throws Exception {
+ if (closeable != null) {
+ closeable.close();
+ }
}
}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerProducerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerProducerTest.java
index 34992ff1d..435af0996 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerProducerTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerProducerTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Samsung. All rights reserved.
- * Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2021, 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,34 +21,32 @@
package org.onap.policy.apex.plugins.event.carrier.restserver;
-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.assertSame;
+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.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.lang.reflect.Field;
import java.util.Random;
import org.apache.commons.lang3.RandomStringUtils;
-import org.junit.After;
-import org.junit.Before;
-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.policy.apex.service.engine.event.ApexEventException;
-import org.onap.policy.apex.service.engine.event.ApexEventReceiver;
import org.onap.policy.apex.service.engine.event.PeeredReference;
import org.onap.policy.apex.service.engine.event.SynchronousEventCache;
import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters;
import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters;
import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode;
-public class ApexRestServerProducerTest {
+class ApexRestServerProducerTest {
ApexRestServerProducer apexRestServerProducer = null;
EventHandlerParameters producerParameters = null;
- ApexEventReceiver incomingEventReceiver = null;
ApexRestServerConsumer apexRestServerConsumer = null;
RestServerCarrierTechnologyParameters restServerCarrierTechnologyParameters = null;
- SynchronousEventCache synchronousEventCache = null;
Random random = new Random();
/**
@@ -56,35 +54,38 @@ public class ApexRestServerProducerTest {
*
* @throws Exception on test set up errors.
*/
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() throws Exception {
apexRestServerConsumer = new ApexRestServerConsumer();
producerParameters = new EventHandlerParameters();
apexRestServerProducer = new ApexRestServerProducer();
}
- @After
- public void tearDown() {
+ @AfterEach
+ void tearDown() {
apexRestServerProducer.stop();
}
- @Test(expected = ApexEventException.class)
- public void testInitWithNonWebSocketCarrierTechnologyParameters() throws ApexEventException {
- producerParameters.setCarrierTechnologyParameters(new CarrierTechnologyParameters() {});
- apexRestServerProducer.init("TestApexRestServerProducer", producerParameters);
+ @Test
+ void testInitWithNonWebSocketCarrierTechnologyParameters() {
+ producerParameters.setCarrierTechnologyParameters(new CarrierTechnologyParameters() {
+ });
+ assertThrows(ApexEventException.class, () ->
+ apexRestServerProducer.init("TestApexRestServerProducer", producerParameters));
}
- @Test(expected = ApexEventException.class)
- public void testInitWithWebSocketCarrierTechnologyParameters() throws ApexEventException {
+ @Test
+ void testInitWithWebSocketCarrierTechnologyParameters() {
restServerCarrierTechnologyParameters = new RestServerCarrierTechnologyParameters();
producerParameters.setCarrierTechnologyParameters(restServerCarrierTechnologyParameters);
- apexRestServerProducer.init("TestApexRestServerProducer", producerParameters);
+ assertThrows(ApexEventException.class, () ->
+ apexRestServerProducer.init("TestApexRestServerProducer", producerParameters));
}
- @Test(expected = ApexEventException.class)
- public void testInitWithNonDefaultValue() throws ApexEventException, NoSuchFieldException,
- SecurityException, IllegalArgumentException, IllegalAccessException {
+ @Test
+ void testInitWithNonDefaultValue() throws NoSuchFieldException,
+ SecurityException, IllegalArgumentException, IllegalAccessException {
restServerCarrierTechnologyParameters = new RestServerCarrierTechnologyParameters();
Field field = RestServerCarrierTechnologyParameters.class.getDeclaredField("host");
field.setAccessible(true);
@@ -93,11 +94,12 @@ public class ApexRestServerProducerTest {
field.setAccessible(true);
field.set(restServerCarrierTechnologyParameters, 65535);
producerParameters.setCarrierTechnologyParameters(restServerCarrierTechnologyParameters);
- apexRestServerProducer.init("TestApexRestServerProducer", producerParameters);
+ assertThrows(ApexEventException.class, () ->
+ apexRestServerProducer.init("TestApexRestServerProducer", producerParameters));
}
@Test
- public void testInitWithSynchronousMode() throws ApexEventException {
+ void testInitWithSynchronousMode() throws ApexEventException {
restServerCarrierTechnologyParameters = new RestServerCarrierTechnologyParameters();
producerParameters.setCarrierTechnologyParameters(restServerCarrierTechnologyParameters);
producerParameters.setPeeredMode(EventHandlerPeeredMode.SYNCHRONOUS, true);
@@ -106,26 +108,26 @@ public class ApexRestServerProducerTest {
}
@Test
- public void testGetName() {
+ void testGetName() {
assertNull(apexRestServerProducer.getName());
}
@Test
- public void testGetPeeredReference() {
+ void testGetPeeredReference() {
assertNull(apexRestServerProducer.getPeeredReference(EventHandlerPeeredMode.REQUESTOR));
}
@Test
- public void testSetPeeredReference() {
+ void testSetPeeredReference() {
PeeredReference peeredReference = new PeeredReference(EventHandlerPeeredMode.REQUESTOR,
- apexRestServerConsumer, apexRestServerProducer);
+ apexRestServerConsumer, apexRestServerProducer);
apexRestServerProducer.setPeeredReference(EventHandlerPeeredMode.REQUESTOR,
- peeredReference);
+ peeredReference);
assertNotNull(apexRestServerProducer.getPeeredReference(EventHandlerPeeredMode.REQUESTOR));
}
@Test
- public void testSendEventNotExistingEventToApex() {
+ void testSendEventNotExistingEventToApex() {
final long executionId = random.nextLong();
final String eventName = RandomStringUtils.randomAlphabetic(7);
final Object event = new Object();
@@ -143,7 +145,7 @@ public class ApexRestServerProducerTest {
}
@Test
- public void testSendEvent() {
+ void testSendEvent() {
final long executionId = random.nextLong();
final String eventName = RandomStringUtils.randomAlphabetic(7);
final Object expected = new Object();
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/RestServerCarrierTechnologyParametersTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/RestServerCarrierTechnologyParametersTest.java
index ef78d3211..ab7a54cdd 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/RestServerCarrierTechnologyParametersTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/RestServerCarrierTechnologyParametersTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Samsung. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019, 2024 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,16 +23,16 @@
package org.onap.policy.apex.plugins.event.carrier.restserver;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.lang.reflect.Field;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ValidationResult;
-public class RestServerCarrierTechnologyParametersTest {
+class RestServerCarrierTechnologyParametersTest {
RestServerCarrierTechnologyParameters restServerCarrierTechnologyParameters = null;
ValidationResult result = null;
@@ -40,28 +40,27 @@ public class RestServerCarrierTechnologyParametersTest {
/**
* Set up testing.
*
- * @throws Exception on test set up errors.
*/
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() {
restServerCarrierTechnologyParameters = new RestServerCarrierTechnologyParameters();
}
@Test
- public void testRestServerCarrierTechnologyParameters() {
+ void testRestServerCarrierTechnologyParameters() {
assertNotNull(restServerCarrierTechnologyParameters);
assertFalse(restServerCarrierTechnologyParameters.isStandalone());
}
@Test
- public void testValidate() {
+ void testValidate() {
result = restServerCarrierTechnologyParameters.validate();
assertNotNull(result);
assertTrue(result.isValid());
}
@Test
- public void testValidateWithNonDefaultValues() throws NoSuchFieldException, SecurityException,
+ void testValidateWithNonDefaultValues() throws NoSuchFieldException, SecurityException,
IllegalArgumentException, IllegalAccessException {
Field field = RestServerCarrierTechnologyParameters.class.getDeclaredField("standalone");
@@ -89,7 +88,7 @@ public class RestServerCarrierTechnologyParametersTest {
}
@Test
- public void testValidateWithValidValues() throws NoSuchFieldException, SecurityException,
+ void testValidateWithValidValues() throws NoSuchFieldException, SecurityException,
IllegalArgumentException, IllegalAccessException {
Field field = RestServerCarrierTechnologyParameters.class.getDeclaredField("standalone");
@@ -119,7 +118,7 @@ public class RestServerCarrierTechnologyParametersTest {
}
@Test
- public void testValidateWithInvalidValues() throws NoSuchFieldException, SecurityException,
+ void testValidateWithInvalidValues() throws NoSuchFieldException, SecurityException,
IllegalArgumentException, IllegalAccessException {
Field field = RestServerCarrierTechnologyParameters.class.getDeclaredField("standalone");
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/SupportApexEventReceiver.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/SupportApexEventReceiver.java
index 773ecafb2..b10eecf21 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/SupportApexEventReceiver.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/SupportApexEventReceiver.java
@@ -27,7 +27,7 @@ import org.onap.policy.apex.service.engine.event.ApexEventException;
import org.onap.policy.apex.service.engine.event.ApexEventReceiver;
/**
- * Support Apex event reveiver for unit test.
+ * Support Apex event receiver for unit test.
*
*/
@Getter