aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2023-08-21 14:35:56 +0100
committeradheli.tavares <adheli.tavares@est.tech>2023-09-22 16:01:50 +0100
commit08ec52b6ed5ef7159087d708bddfa40d9ac03717 (patch)
treee3272e724c86cba0b57d84d43b6acc51e2f5ab32 /main/src
parentff1698142a22a4811895d2ac7047fbadbb36b396 (diff)
Upgrade Java 17
Issue-ID: POLICY-4803 Change-Id: Iad0d08ee6f8ab18eb177b458d8edbba4002bcc73 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/org/onap/policy/distribution/main/rest/DistributionRestController.java10
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/TestExceptions.java16
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java16
-rwxr-xr-x[-rw-r--r--]main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java45
-rwxr-xr-x[-rw-r--r--]main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java92
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestPluginHandlerParameters.java56
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java57
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyForwarderParameters.java56
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestReceptionHandlerParameters.java72
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java54
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java45
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionActivator.java25
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionCommandLineArguments.java22
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/startstop/TestMain.java26
14 files changed, 294 insertions, 298 deletions
diff --git a/main/src/main/java/org/onap/policy/distribution/main/rest/DistributionRestController.java b/main/src/main/java/org/onap/policy/distribution/main/rest/DistributionRestController.java
index 702f8a2a..e9e4b04e 100644
--- a/main/src/main/java/org/onap/policy/distribution/main/rest/DistributionRestController.java
+++ b/main/src/main/java/org/onap/policy/distribution/main/rest/DistributionRestController.java
@@ -26,11 +26,11 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Info;
import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Tag;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
import org.onap.policy.common.endpoints.report.HealthCheckReport;
/**
diff --git a/main/src/test/java/org/onap/policy/distribution/main/TestExceptions.java b/main/src/test/java/org/onap/policy/distribution/main/TestExceptions.java
index 0f5e5023..4a15506e 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/TestExceptions.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/TestExceptions.java
@@ -20,19 +20,19 @@
package org.onap.policy.distribution.main;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import java.io.IOException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class TestExceptions {
+class TestExceptions {
@Test
- public void test() {
- assertNotNull(new PolicyDistributionException("Message"));
- assertNotNull(new PolicyDistributionException("Message", new IOException()));
+ void test() {
+ assertDoesNotThrow(() -> new PolicyDistributionException("Message"));
+ assertDoesNotThrow(() -> new PolicyDistributionException("Message", new IOException()));
- assertNotNull(new PolicyDistributionRuntimeException("Message"));
- assertNotNull(new PolicyDistributionRuntimeException("Message", new IOException()));
+ assertDoesNotThrow(() -> new PolicyDistributionRuntimeException("Message"));
+ assertDoesNotThrow(() -> new PolicyDistributionRuntimeException("Message", new IOException()));
}
}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java
index 9f6fab5a..57fa97d1 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java
@@ -133,6 +133,22 @@ public class CommonTestData {
/**
* Returns an instance of ReceptionHandlerParameters for test cases.
*
+ * @param port the port
+ * @return the restServerParameters object
+ */
+ public RestServerParameters getRestServerParameters(final int port) {
+ final var fileName = "src/test/resources/parameters/RestServerParameters.json";
+ try {
+ var json = Files.readString(new File(fileName).toPath());
+ return coder.decode(json.replace("6969", String.valueOf(port)), RestServerParameters.class);
+ } catch (final Exception exp) {
+ throw new RuntimeException("cannot read/decode " + fileName, exp);
+ }
+ }
+
+ /**
+ * Returns an instance of ReceptionHandlerParameters for test cases.
+ *
* @param isEmpty boolean value to represent that object created should be empty or not
* @return the receptionHandlerParameters object
*/
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java
index 0b5bfcb8..a48b0bd7 100644..100755
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java
@@ -23,12 +23,12 @@
package org.onap.policy.distribution.main.parameters;
import static org.assertj.core.api.Assertions.assertThat;
-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 java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.endpoints.parameters.RestServerParameters;
import org.onap.policy.common.parameters.ValidationResult;
import org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup;
@@ -42,25 +42,24 @@ import org.onap.policy.distribution.reception.parameters.ReceptionHandlerParamet
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class TestDistributionParameterGroup {
+class TestDistributionParameterGroup {
CommonTestData commonTestData = new CommonTestData();
@Test
- public void testDistributionParameterGroup() {
- final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false);
- final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
- commonTestData.getReceptionHandlerParameters(false);
- final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurations =
+ void testDistributionParameterGroup() {
+ final var restServerParameters = commonTestData.getRestServerParameters(false);
+ final var receptionHandlerParameters = commonTestData.getReceptionHandlerParameters(false);
+ final var receptionHandlerConfigurations =
commonTestData.getReceptionHandlerConfigurationParameters(false);
- final Map<String, PolicyForwarderConfigurationParameterGroup> forwarderConfigurations =
+ final var forwarderConfigurations =
commonTestData.getPolicyForwarderConfigurationParameters(false);
- final Map<String, PolicyDecoderConfigurationParameterGroup> decoderConfigurations =
+ final var decoderConfigurations =
commonTestData.getPolicyDecoderConfigurationParameters(false);
- final DistributionParameterGroup distributionParameters = new DistributionParameterGroup(
+ final var distributionParameters = new DistributionParameterGroup(
CommonTestData.DISTRIBUTION_GROUP_NAME, restServerParameters, receptionHandlerParameters,
receptionHandlerConfigurations, forwarderConfigurations, decoderConfigurations);
- final ValidationResult validationResult = distributionParameters.validate();
+ final var validationResult = distributionParameters.validate();
assertTrue(validationResult.isValid());
assertEquals(restServerParameters.getHost(), distributionParameters.getRestServerParameters().getHost());
assertEquals(restServerParameters.getPort(), distributionParameters.getRestServerParameters().getPort());
@@ -100,9 +99,9 @@ public class TestDistributionParameterGroup {
}
@Test
- public void testDistributionParameterGroup_NullName() {
- final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false);
- final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
+ void testDistributionParameterGroup_NullName() {
+ final var restServerParameters = commonTestData.getRestServerParameters(false);
+ final var receptionHandlerParameters =
commonTestData.getReceptionHandlerParameters(false);
final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurations =
commonTestData.getReceptionHandlerConfigurationParameters(false);
@@ -116,7 +115,7 @@ public class TestDistributionParameterGroup {
receptionHandlerConfigurations, forwarderConfigurations, decoderConfigurations);
final ValidationResult validationResult = distributionParameters.validate();
assertFalse(validationResult.isValid());
- assertEquals(null, distributionParameters.getName());
+ assertThat(distributionParameters.getName()).isNull();
assertEquals(
receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getReceptionHandlerType(),
distributionParameters.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY)
@@ -134,7 +133,7 @@ public class TestDistributionParameterGroup {
}
@Test
- public void testDistributionParameterGroup_EmptyName() {
+ void testDistributionParameterGroup_EmptyName() {
final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false);
final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
commonTestData.getReceptionHandlerParameters(false);
@@ -168,7 +167,7 @@ public class TestDistributionParameterGroup {
}
@Test
- public void testDistributionParameterGroup_NullReceptionHandlerParameters() {
+ void testDistributionParameterGroup_NullReceptionHandlerParameters() {
final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false);
final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurations =
commonTestData.getReceptionHandlerConfigurationParameters(false);
@@ -184,7 +183,7 @@ public class TestDistributionParameterGroup {
}
@Test
- public void testDistributionParameterGroup_EmptyReceptionHandlerParameters() {
+ void testDistributionParameterGroup_EmptyReceptionHandlerParameters() {
final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false);
final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
commonTestData.getReceptionHandlerParameters(true);
@@ -204,7 +203,7 @@ public class TestDistributionParameterGroup {
}
@Test
- public void testDistributionParameterGroup_EmptyRestServerParameters() {
+ void testDistributionParameterGroup_EmptyRestServerParameters() {
final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(true);
final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
commonTestData.getReceptionHandlerParameters(false);
@@ -224,7 +223,7 @@ public class TestDistributionParameterGroup {
}
@Test
- public void testDistributionParameterGroup_NullRestServerParameters() {
+ void testDistributionParameterGroup_NullRestServerParameters() {
final RestServerParameters restServerParameters = null;
final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
commonTestData.getReceptionHandlerParameters(false);
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java
index b83b3fc9..697cdd64 100644..100755
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java
@@ -23,13 +23,13 @@
package org.onap.policy.distribution.main.parameters;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-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 java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.cmd.CommandLineException;
import org.onap.policy.distribution.main.PolicyDistributionException;
import org.onap.policy.distribution.main.startstop.DistributionCommandLineArguments;
@@ -41,20 +41,20 @@ import org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParamet
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class TestDistributionParameterHandler {
+class TestDistributionParameterHandler {
@Test
- public void testParameterHandlerNoParameterFile() throws PolicyDistributionException, CommandLineException {
+ void testParameterHandlerNoParameterFile() throws PolicyDistributionException, CommandLineException {
verifyFailure("NoParameterFile.json", PolicyDistributionException.class, "FileNotFoundException");
}
@Test
- public void testParameterHandlerEmptyParameters() throws PolicyDistributionException, CommandLineException {
+ void testParameterHandlerEmptyParameters() throws PolicyDistributionException, CommandLineException {
verifyFailure("EmptyParameters.json", PolicyDistributionException.class,
"no parameters found in \"parameters/EmptyParameters.json\"");
}
@Test
- public void testParameterHandlerBadParameters() throws PolicyDistributionException, CommandLineException {
+ void testParameterHandlerBadParameters() throws PolicyDistributionException, CommandLineException {
verifyFailure("BadParameters.json", PolicyDistributionException.class,
"error reading parameters from \"parameters/BadParameters.json\"\n"
+ "(JsonSyntaxException):java.lang.IllegalStateException: "
@@ -62,7 +62,7 @@ public class TestDistributionParameterHandler {
}
@Test
- public void testParameterHandlerInvalidParameters() throws PolicyDistributionException, CommandLineException {
+ void testParameterHandlerInvalidParameters() throws PolicyDistributionException, CommandLineException {
verifyFailure("InvalidParameters.json", PolicyDistributionException.class,
"error reading parameters from \"parameters/InvalidParameters.json\"\n"
+ "(JsonSyntaxException):java.lang.IllegalStateException: "
@@ -70,30 +70,30 @@ public class TestDistributionParameterHandler {
}
@Test
- public void testParameterHandlerNoParameters() throws PolicyDistributionException, CommandLineException {
+ void testParameterHandlerNoParameters() throws PolicyDistributionException, CommandLineException {
verifyFailure("NoParameters.json", PolicyDistributionException.class,
"\"receptionHandlerParameters\" value \"null\" INVALID, is null");
}
@Test
- public void testParameterHandlerMinumumParameters() throws PolicyDistributionException, CommandLineException {
+ void testParameterHandlerMinumumParameters() throws PolicyDistributionException, CommandLineException {
final String[] minArgumentString = {"-c", "parameters/MinimumParameters.json"};
- final DistributionCommandLineArguments minArguments = new DistributionCommandLineArguments();
+ final var minArguments = new DistributionCommandLineArguments();
minArguments.parse(minArgumentString);
- final DistributionParameterGroup parGroup = new DistributionParameterHandler().getParameters(minArguments);
+ final var parGroup = new DistributionParameterHandler().getParameters(minArguments);
assertEquals(CommonTestData.DISTRIBUTION_GROUP_NAME, parGroup.getName());
}
@Test
- public void testDistributionParameterGroup() throws PolicyDistributionException, CommandLineException {
+ void testDistributionParameterGroup() throws PolicyDistributionException, CommandLineException {
final String[] distributionConfigParameters = {"-c", "parameters/DistributionConfigParameters.json"};
- final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
+ final var arguments = new DistributionCommandLineArguments();
arguments.parse(distributionConfigParameters);
- final DistributionParameterGroup parGroup = new DistributionParameterHandler().getParameters(arguments);
+ final var parGroup = new DistributionParameterHandler().getParameters(arguments);
assertTrue(arguments.checkSetConfigurationFilePath());
assertEquals(CommonTestData.DISTRIBUTION_GROUP_NAME, parGroup.getName());
assertEquals(CommonTestData.RECEPTION_HANDLER_TYPE, parGroup.getReceptionHandlerParameters()
@@ -118,14 +118,14 @@ public class TestDistributionParameterHandler {
}
@Test
- public void testDistributionParameterGroup_InvalidForwarderConfigurationClassName()
+ void testDistributionParameterGroup_InvalidForwarderConfigurationClassName()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_InvalidForwarderConfigurationClassName.json",
PolicyDistributionException.class, "parameter \"parameterClassName\" value \"\" invalid in JSON file");
}
@Test
- public void testDistributionParameterGroup_UnknownForwarderConfigurationClassName()
+ void testDistributionParameterGroup_UnknownForwarderConfigurationClassName()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_UnknownForwarderConfigurationClassName.json",
PolicyDistributionException.class,
@@ -133,58 +133,58 @@ public class TestDistributionParameterHandler {
}
@Test
- public void testDistributionParameterGroup_InvalidName() throws PolicyDistributionException, CommandLineException {
+ void testDistributionParameterGroup_InvalidName() throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_InvalidName.json", PolicyDistributionException.class,
"\"name\" value \" \" INVALID, is blank");
}
@Test
- public void testDistributionParameterGroup_NoReceptionHandler()
+ void testDistributionParameterGroup_NoReceptionHandler()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_NoReceptionHandler.json", PolicyDistributionException.class,
"\"receptionHandlerParameters\" value \"null\" INVALID, is null");
}
@Test
- public void testDistributionParameterGroup_EmptyReceptionHandler()
+ void testDistributionParameterGroup_EmptyReceptionHandler()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_EmptyReceptionHandler.json", PolicyDistributionException.class,
"\"receptionHandlerParameters\" value \"{}\" INVALID, minimum number of elements: 1");
}
@Test
- public void testDistributionParameterGroup_NoPolicyDecoder()
+ void testDistributionParameterGroup_NoPolicyDecoder()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_NoPolicyDecoder.json", PolicyDistributionException.class,
"\"policyDecoders\" value \"null\" INVALID, is null");
}
@Test
- public void testDistributionParameterGroup_NoPolicyForwarder()
+ void testDistributionParameterGroup_NoPolicyForwarder()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_NoPolicyForwarder.json", PolicyDistributionException.class,
"\"policyForwarderConfigurationParameters\" value \"null\" INVALID, is null");
}
@Test
- public void testDistributionParameterGroup_EmptyPolicyDecoder()
+ void testDistributionParameterGroup_EmptyPolicyDecoder()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_EmptyPolicyDecoder.json", PolicyDistributionException.class,
"\"policyDecoders\" value \"{}\" INVALID, minimum number of elements: 1");
}
@Test
- public void testDistributionParameterGroup_EmptyPolicyForwarder()
+ void testDistributionParameterGroup_EmptyPolicyForwarder()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_EmptyPolicyForwarder.json", PolicyDistributionException.class,
"\"policyForwarders\" value \"{}\" INVALID, minimum number of elements: 1");
}
@Test
- public void testDistributionParameterGroup_InvalidReceptionHandlerParameters()
+ void testDistributionParameterGroup_InvalidReceptionHandlerParameters()
throws PolicyDistributionException, IOException, CommandLineException {
- String resultString = Files
+ var resultString = Files
.readString(
Paths.get("src/test/resources/expectedValidationResults/InvalidReceptionHandlerParameters.txt"))
.trim().replaceAll("\\r\\n", "\\\n");
@@ -194,77 +194,77 @@ public class TestDistributionParameterHandler {
}
@Test
- public void testDistributionParameterGroup_InvalidDecoderAndForwarderParameters()
+ void testDistributionParameterGroup_InvalidDecoderAndForwarderParameters()
throws PolicyDistributionException, IOException, CommandLineException {
- String resultString = new String(Files
+ var resultString = Files
.readString(Paths
.get("src/test/resources/expectedValidationResults/InvalidDecoderAndForwarderParameters.txt"))
- .trim().replaceAll("\\r\\n", "\\\n"));
+ .trim().replaceAll("\\r\\n", "\\\n");
verifyFailure("DistributionConfigParameters_InvalidDecoderAndForwarderParameters.json",
PolicyDistributionException.class, resultString);
}
@Test
- public void testDistributionParameterGroup_InvalidRestServerParameters()
+ void testDistributionParameterGroup_InvalidRestServerParameters()
throws PolicyDistributionException, IOException, CommandLineException {
- String resultString = new String(Files
+ var resultString = Files
.readString(Paths.get("src/test/resources/expectedValidationResults/InvalidRestServerParameters.txt"))
- .trim().replaceAll("\\r\\n", "\\\n"));
+ .trim().replaceAll("\\r\\n", "\\\n");
verifyFailure("DistributionConfigParameters_InvalidRestServerParameters.json",
PolicyDistributionException.class, resultString);
}
@Test
- public void testDistributionVersion() throws PolicyDistributionException, CommandLineException {
+ void testDistributionVersion() throws PolicyDistributionException, CommandLineException {
final String[] distributionConfigParameters = {"-v"};
- final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
- final String version = arguments.parse(distributionConfigParameters);
+ final var arguments = new DistributionCommandLineArguments();
+ final var version = arguments.parse(distributionConfigParameters);
assertTrue(version.startsWith("ONAP Policy Framework Distribution Service"));
}
@Test
- public void testDistributionHelp() throws PolicyDistributionException, CommandLineException {
+ void testDistributionHelp() throws PolicyDistributionException, CommandLineException {
final String[] distributionConfigParameters = {"-h"};
- final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
- final String help = arguments.parse(distributionConfigParameters);
+ final var arguments = new DistributionCommandLineArguments();
+ final var help = arguments.parse(distributionConfigParameters);
assertTrue(help.startsWith("usage:"));
}
@Test
- public void testDistributionInvalidOption() throws PolicyDistributionException {
+ void testDistributionInvalidOption() throws PolicyDistributionException {
final String[] distributionConfigParameters = {"-d"};
- final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
+ final var arguments = new DistributionCommandLineArguments();
assertThatThrownBy(() -> arguments.parse(distributionConfigParameters))
.hasMessageContaining("invalid command line arguments specified");
}
@Test
- public void testDistributionParameterGroup_InvalidReceptionHandlerClass()
+ void testDistributionParameterGroup_InvalidReceptionHandlerClass()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_InvalidReceptionHandlerClass.json",
PolicyDistributionException.class, "could not find class");
}
@Test
- public void testDistributionParameterGroup_EmptyReceptionHandlerClass()
+ void testDistributionParameterGroup_EmptyReceptionHandlerClass()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_EmptyReceptionHandlerClass.json", PolicyDistributionException.class,
"invalid in JSON file");
}
@Test
- public void testDistributionParameterGroup_InvalidDecoderConfigurationClassName()
+ void testDistributionParameterGroup_InvalidDecoderConfigurationClassName()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_InvalidDecoderConfigurationClassName.json",
PolicyDistributionException.class, "parameter \"parameterClassName\" value \"\" invalid in JSON file");
}
@Test
- public void testDistributionParameterGroup_UnknownDecoderConfigurationClassName()
+ void testDistributionParameterGroup_UnknownDecoderConfigurationClassName()
throws PolicyDistributionException, CommandLineException {
verifyFailure("DistributionConfigParameters_UnknownDecoderConfigurationClassName.json",
PolicyDistributionException.class,
@@ -275,10 +275,10 @@ public class TestDistributionParameterHandler {
throws PolicyDistributionException, CommandLineException {
final String[] distributionConfigParameters = {"-c", "parameters/" + fileName};
- final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
+ final var arguments = new DistributionCommandLineArguments();
arguments.parse(distributionConfigParameters);
- DistributionParameterHandler paramHandler = new DistributionParameterHandler();
+ var paramHandler = new DistributionParameterHandler();
assertThatThrownBy(() -> paramHandler.getParameters(arguments)).isInstanceOf(clazz)
.hasMessageContaining(expectedMessage);
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPluginHandlerParameters.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPluginHandlerParameters.java
index 9def403d..e7a15902 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPluginHandlerParameters.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPluginHandlerParameters.java
@@ -23,31 +23,27 @@
package org.onap.policy.distribution.main.parameters;
import static org.assertj.core.api.Assertions.assertThat;
-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 java.util.Map;
-import org.junit.Test;
-import org.onap.policy.common.parameters.ValidationResult;
-import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParameters;
+import org.junit.jupiter.api.Test;
import org.onap.policy.distribution.reception.parameters.PluginHandlerParameters;
-import org.onap.policy.distribution.reception.parameters.PolicyDecoderParameters;
/**
* Class to perform unit test of PluginHandlerParameters.
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class TestPluginHandlerParameters {
+class TestPluginHandlerParameters {
CommonTestData commonTestData = new CommonTestData();
@Test
- public void testPluginHandlerParameters() {
- final Map<String, PolicyDecoderParameters> policyDecoders = commonTestData.getPolicyDecoders(false);
- final Map<String, PolicyForwarderParameters> policyForwarders = commonTestData.getPolicyForwarders(false);
- final PluginHandlerParameters pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
- final ValidationResult validationResult = pHParameters.validate();
+ void testPluginHandlerParameters() {
+ final var policyDecoders = commonTestData.getPolicyDecoders(false);
+ final var policyForwarders = commonTestData.getPolicyForwarders(false);
+ final var pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
+ final var validationResult = pHParameters.validate();
assertEquals(policyDecoders.get(CommonTestData.DUMMY_DECODER_KEY),
pHParameters.getPolicyDecoders().get(CommonTestData.DUMMY_DECODER_KEY));
assertEquals(policyForwarders.get(CommonTestData.DUMMY_ENGINE_FORWARDER_KEY),
@@ -56,36 +52,36 @@ public class TestPluginHandlerParameters {
}
@Test
- public void testPluginHandlerParameters_NullPolicyDecoders() {
- final Map<String, PolicyForwarderParameters> policyForwarders = commonTestData.getPolicyForwarders(false);
- final PluginHandlerParameters pHParameters = new PluginHandlerParameters(null, policyForwarders);
+ void testPluginHandlerParameters_NullPolicyDecoders() {
+ final var policyForwarders = commonTestData.getPolicyForwarders(false);
+ final var pHParameters = new PluginHandlerParameters(null, policyForwarders);
assertThat(pHParameters.validate().getResult()).contains("\"policyDecoders\" value \"null\" INVALID, is null");
}
@Test
- public void testPluginHandlerParameters_NullPolicyForwarders() {
- final Map<String, PolicyDecoderParameters> policyDecoders = commonTestData.getPolicyDecoders(false);
- final PluginHandlerParameters pHParameters = new PluginHandlerParameters(policyDecoders, null);
+ void testPluginHandlerParameters_NullPolicyForwarders() {
+ final var policyDecoders = commonTestData.getPolicyDecoders(false);
+ final var pHParameters = new PluginHandlerParameters(policyDecoders, null);
assertThat(pHParameters.validate().getResult())
.contains("\"policyForwarders\" value \"null\" INVALID, is null");
}
@Test
- public void testPluginHandlerParameters_EmptyPolicyDecoders() {
- final Map<String, PolicyDecoderParameters> policyDecoders = commonTestData.getPolicyDecoders(true);
- final Map<String, PolicyForwarderParameters> policyForwarders = commonTestData.getPolicyForwarders(false);
- final PluginHandlerParameters pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
- ValidationResult result = pHParameters.validate();
+ void testPluginHandlerParameters_EmptyPolicyDecoders() {
+ final var policyDecoders = commonTestData.getPolicyDecoders(true);
+ final var policyForwarders = commonTestData.getPolicyForwarders(false);
+ final var pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
+ var result = pHParameters.validate();
assertFalse(result.isValid());
assertThat(pHParameters.validate().getResult()).contains("\"policyDecoders\"", "minimum");
}
@Test
- public void testPluginHandlerParameters_EmptyPolicyForwarders() {
- final Map<String, PolicyForwarderParameters> policyForwarders = commonTestData.getPolicyForwarders(true);
- final Map<String, PolicyDecoderParameters> policyDecoders = commonTestData.getPolicyDecoders(false);
- final PluginHandlerParameters pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
- ValidationResult result = pHParameters.validate();
+ void testPluginHandlerParameters_EmptyPolicyForwarders() {
+ final var policyForwarders = commonTestData.getPolicyForwarders(true);
+ final var policyDecoders = commonTestData.getPolicyDecoders(false);
+ final var pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
+ var result = pHParameters.validate();
assertFalse(result.isValid());
assertThat(pHParameters.validate().getResult()).contains("\"policyForwarders\"", "minimum");
}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java
index 4195f1b6..74b8c213 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java
@@ -22,15 +22,14 @@
package org.onap.policy.distribution.main.parameters;
import static org.assertj.core.api.Assertions.assertThat;
-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 static org.onap.policy.distribution.main.parameters.CommonTestData.DECODER_CLASS_NAME;
import static org.onap.policy.distribution.main.parameters.CommonTestData.DECODER_CONFIGURATION_PARAMETERS;
import static org.onap.policy.distribution.main.parameters.CommonTestData.DECODER_TYPE;
-import org.junit.Test;
-import org.onap.policy.common.parameters.ValidationResult;
+import org.junit.jupiter.api.Test;
import org.onap.policy.distribution.reception.parameters.PolicyDecoderParameters;
/**
@@ -38,13 +37,13 @@ import org.onap.policy.distribution.reception.parameters.PolicyDecoderParameters
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class TestPolicyDecoderParameters {
+class TestPolicyDecoderParameters {
@Test
- public void testPolicyDecoderParameters() {
- final PolicyDecoderParameters pDParameters =
+ void testPolicyDecoderParameters() {
+ final var pDParameters =
new PolicyDecoderParameters(DECODER_TYPE, DECODER_CLASS_NAME, DECODER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pDParameters.validate();
+ final var validationResult = pDParameters.validate();
assertEquals(DECODER_TYPE, pDParameters.getDecoderType());
assertEquals(DECODER_CLASS_NAME, pDParameters.getDecoderClassName());
assertEquals(DECODER_CONFIGURATION_PARAMETERS, pDParameters.getDecoderConfigurationName());
@@ -52,10 +51,10 @@ public class TestPolicyDecoderParameters {
}
@Test
- public void testPolicyDecoderParameters_InvalidDecoderType() {
- final PolicyDecoderParameters pDParameters =
+ void testPolicyDecoderParameters_InvalidDecoderType() {
+ final var pDParameters =
new PolicyDecoderParameters("", DECODER_CLASS_NAME, DECODER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pDParameters.validate();
+ final var validationResult = pDParameters.validate();
assertEquals("", pDParameters.getDecoderType());
assertEquals(DECODER_CLASS_NAME, pDParameters.getDecoderClassName());
assertFalse(validationResult.isValid());
@@ -63,10 +62,10 @@ public class TestPolicyDecoderParameters {
}
@Test
- public void testPolicyDecoderParameters_InvalidDecoderClassName() {
- final PolicyDecoderParameters pDParameters =
+ void testPolicyDecoderParameters_InvalidDecoderClassName() {
+ final var pDParameters =
new PolicyDecoderParameters(DECODER_TYPE, "", DECODER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pDParameters.validate();
+ final var validationResult = pDParameters.validate();
assertEquals(DECODER_TYPE, pDParameters.getDecoderType());
assertEquals("", pDParameters.getDecoderClassName());
assertFalse(validationResult.isValid());
@@ -74,10 +73,10 @@ public class TestPolicyDecoderParameters {
}
@Test
- public void testPolicyDecoderParameters_InvalidDecoderTypeAndClassName() {
- final PolicyDecoderParameters pDParameters =
+ void testPolicyDecoderParameters_InvalidDecoderTypeAndClassName() {
+ final var pDParameters =
new PolicyDecoderParameters("", "", DECODER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pDParameters.validate();
+ final var validationResult = pDParameters.validate();
assertEquals("", pDParameters.getDecoderType());
assertEquals("", pDParameters.getDecoderClassName());
assertFalse(validationResult.isValid());
@@ -86,32 +85,32 @@ public class TestPolicyDecoderParameters {
}
@Test
- public void testPolicyDecoderParameters_NullDecoderType() {
- final PolicyDecoderParameters pDParameters =
+ void testPolicyDecoderParameters_NullDecoderType() {
+ final var pDParameters =
new PolicyDecoderParameters(null, DECODER_CLASS_NAME, DECODER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pDParameters.validate();
- assertEquals(null, pDParameters.getDecoderType());
+ final var validationResult = pDParameters.validate();
+ assertThat(pDParameters.getDecoderType()).isNull();
assertEquals(DECODER_CLASS_NAME, pDParameters.getDecoderClassName());
assertFalse(validationResult.isValid());
assertThat(validationResult.getResult()).contains("\"decoderType\" value \"null\" INVALID, is null");
}
@Test
- public void testPolicyDecoderParameters_NullDecoderClassName() {
- final PolicyDecoderParameters pDParameters =
+ void testPolicyDecoderParameters_NullDecoderClassName() {
+ final var pDParameters =
new PolicyDecoderParameters(DECODER_TYPE, null, DECODER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pDParameters.validate();
+ final var validationResult = pDParameters.validate();
assertEquals(DECODER_TYPE, pDParameters.getDecoderType());
- assertEquals(null, pDParameters.getDecoderClassName());
+ assertThat(pDParameters.getDecoderClassName()).isNull();
assertFalse(validationResult.isValid());
assertThat(validationResult.getResult()).contains("\"decoderClassName\" value \"null\" INVALID, is null");
}
@Test
- public void testPolicyDecoderParameters_InvalidDecoderClass() {
- final PolicyDecoderParameters pDParameters = new PolicyDecoderParameters(DECODER_TYPE,
+ void testPolicyDecoderParameters_InvalidDecoderClass() {
+ final var pDParameters = new PolicyDecoderParameters(DECODER_TYPE,
DECODER_CLASS_NAME + "Invalid", DECODER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pDParameters.validate();
+ final var validationResult = pDParameters.validate();
assertEquals(DECODER_TYPE, pDParameters.getDecoderType());
assertEquals(DECODER_CLASS_NAME + "Invalid", pDParameters.getDecoderClassName());
assertFalse(validationResult.isValid());
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyForwarderParameters.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyForwarderParameters.java
index 5dc1b448..b088194e 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyForwarderParameters.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyForwarderParameters.java
@@ -22,14 +22,14 @@
package org.onap.policy.distribution.main.parameters;
import static org.assertj.core.api.Assertions.assertThat;
-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 static org.onap.policy.distribution.main.parameters.CommonTestData.FORWARDER_CLASS_NAME;
import static org.onap.policy.distribution.main.parameters.CommonTestData.FORWARDER_CONFIGURATION_PARAMETERS;
import static org.onap.policy.distribution.main.parameters.CommonTestData.FORWARDER_TYPE;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.parameters.ValidationResult;
import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParameters;
@@ -38,23 +38,23 @@ import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParamet
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class TestPolicyForwarderParameters {
+class TestPolicyForwarderParameters {
@Test
- public void testPolicyForwarderParameters() {
- final PolicyForwarderParameters pFParameters =
+ void testPolicyForwarderParameters() {
+ final var pFParameters =
new PolicyForwarderParameters(FORWARDER_TYPE, FORWARDER_CLASS_NAME, FORWARDER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pFParameters.validate();
+ final var validationResult = pFParameters.validate();
assertEquals(FORWARDER_TYPE, pFParameters.getForwarderType());
assertEquals(FORWARDER_CLASS_NAME, pFParameters.getForwarderClassName());
assertTrue(validationResult.isValid());
}
@Test
- public void testPolicyForwarderParameters_InvalidForwarderType() {
- final PolicyForwarderParameters pFParameters =
+ void testPolicyForwarderParameters_InvalidForwarderType() {
+ final var pFParameters =
new PolicyForwarderParameters("", FORWARDER_CLASS_NAME, FORWARDER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pFParameters.validate();
+ final var validationResult = pFParameters.validate();
assertEquals("", pFParameters.getForwarderType());
assertEquals(FORWARDER_CLASS_NAME, pFParameters.getForwarderClassName());
assertFalse(validationResult.isValid());
@@ -62,10 +62,10 @@ public class TestPolicyForwarderParameters {
}
@Test
- public void testPolicyForwarderParameters_InvalidForwarderClassName() {
- final PolicyForwarderParameters pFParameters =
+ void testPolicyForwarderParameters_InvalidForwarderClassName() {
+ final var pFParameters =
new PolicyForwarderParameters(FORWARDER_TYPE, "", FORWARDER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pFParameters.validate();
+ final var validationResult = pFParameters.validate();
assertEquals(CommonTestData.FORWARDER_TYPE, pFParameters.getForwarderType());
assertEquals("", pFParameters.getForwarderClassName());
assertFalse(validationResult.isValid());
@@ -73,10 +73,10 @@ public class TestPolicyForwarderParameters {
}
@Test
- public void testPolicyForwarderParameters_InvalidForwarderTypeAndClassName() {
- final PolicyForwarderParameters pFParameters =
+ void testPolicyForwarderParameters_InvalidForwarderTypeAndClassName() {
+ final var pFParameters =
new PolicyForwarderParameters("", "", FORWARDER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pFParameters.validate();
+ final var validationResult = pFParameters.validate();
assertEquals("", pFParameters.getForwarderType());
assertEquals("", pFParameters.getForwarderClassName());
assertFalse(validationResult.isValid());
@@ -85,32 +85,32 @@ public class TestPolicyForwarderParameters {
}
@Test
- public void testPolicyForwarderParameters_NullForwarderType() {
- final PolicyForwarderParameters pFParameters =
+ void testPolicyForwarderParameters_NullForwarderType() {
+ final var pFParameters =
new PolicyForwarderParameters(null, FORWARDER_CLASS_NAME, FORWARDER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pFParameters.validate();
- assertEquals(null, pFParameters.getForwarderType());
+ final var validationResult = pFParameters.validate();
+ assertThat(pFParameters.getForwarderType()).isNull();
assertEquals(FORWARDER_CLASS_NAME, pFParameters.getForwarderClassName());
assertFalse(validationResult.isValid());
assertThat(validationResult.getResult()).contains("\"forwarderType\" value \"null\" INVALID, is null");
}
@Test
- public void testPolicyForwarderParameters_NullForwarderClassName() {
- final PolicyForwarderParameters pFParameters =
+ void testPolicyForwarderParameters_NullForwarderClassName() {
+ final var pFParameters =
new PolicyForwarderParameters(FORWARDER_TYPE, null, FORWARDER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pFParameters.validate();
+ final var validationResult = pFParameters.validate();
assertEquals(FORWARDER_TYPE, pFParameters.getForwarderType());
- assertEquals(null, pFParameters.getForwarderClassName());
+ assertThat(pFParameters.getForwarderClassName()).isNull();
assertFalse(validationResult.isValid());
assertThat(validationResult.getResult()).contains("\"forwarderClassName\" value \"null\" INVALID, is null");
}
@Test
- public void testPolicyForwarderParameters_InvalidForwarderClass() {
- final PolicyForwarderParameters pFParameters = new PolicyForwarderParameters(FORWARDER_TYPE,
+ void testPolicyForwarderParameters_InvalidForwarderClass() {
+ final var pFParameters = new PolicyForwarderParameters(FORWARDER_TYPE,
FORWARDER_CLASS_NAME + "Invalid", FORWARDER_CONFIGURATION_PARAMETERS);
- final ValidationResult validationResult = pFParameters.validate();
+ final var validationResult = pFParameters.validate();
assertEquals(FORWARDER_TYPE, pFParameters.getForwarderType());
assertEquals(FORWARDER_CLASS_NAME + "Invalid", pFParameters.getForwarderClassName());
assertFalse(validationResult.isValid());
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestReceptionHandlerParameters.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestReceptionHandlerParameters.java
index c02b96bc..41a82bca 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestReceptionHandlerParameters.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestReceptionHandlerParameters.java
@@ -22,13 +22,11 @@
package org.onap.policy.distribution.main.parameters;
import static org.assertj.core.api.Assertions.assertThat;
-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 org.junit.Test;
-import org.onap.policy.common.parameters.ValidationResult;
-import org.onap.policy.distribution.reception.parameters.PluginHandlerParameters;
+import org.junit.jupiter.api.Test;
import org.onap.policy.distribution.reception.parameters.ReceptionHandlerParameters;
/**
@@ -36,16 +34,16 @@ import org.onap.policy.distribution.reception.parameters.ReceptionHandlerParamet
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class TestReceptionHandlerParameters {
+class TestReceptionHandlerParameters {
CommonTestData commonTestData = new CommonTestData();
@Test
- public void testReceptionHandlerParameters() {
- final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
- final ReceptionHandlerParameters rHParameters = new ReceptionHandlerParameters(
+ void testReceptionHandlerParameters() {
+ final var pHParameters = commonTestData.getPluginHandlerParameters(false);
+ final var rHParameters = new ReceptionHandlerParameters(
CommonTestData.RECEPTION_HANDLER_TYPE, CommonTestData.RECEPTION_HANDLER_CLASS_NAME,
CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, pHParameters);
- final ValidationResult validationResult = rHParameters.validate();
+ final var validationResult = rHParameters.validate();
assertEquals(CommonTestData.RECEPTION_HANDLER_TYPE, rHParameters.getReceptionHandlerType());
assertEquals(CommonTestData.RECEPTION_HANDLER_CLASS_NAME, rHParameters.getReceptionHandlerClassName());
assertEquals(CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS,
@@ -55,13 +53,13 @@ public class TestReceptionHandlerParameters {
}
@Test
- public void testReceptionHandlerParameters_NullReceptionHandlerType() {
- final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
- final ReceptionHandlerParameters rHParameters =
+ void testReceptionHandlerParameters_NullReceptionHandlerType() {
+ final var pHParameters = commonTestData.getPluginHandlerParameters(false);
+ final var rHParameters =
new ReceptionHandlerParameters(null, CommonTestData.RECEPTION_HANDLER_CLASS_NAME,
CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, pHParameters);
- final ValidationResult validationResult = rHParameters.validate();
- assertEquals(null, rHParameters.getReceptionHandlerType());
+ final var validationResult = rHParameters.validate();
+ assertThat(rHParameters.getReceptionHandlerType()).isNull();
assertEquals(CommonTestData.RECEPTION_HANDLER_CLASS_NAME, rHParameters.getReceptionHandlerClassName());
assertEquals(CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS,
rHParameters.getReceptionHandlerConfigurationName());
@@ -71,14 +69,14 @@ public class TestReceptionHandlerParameters {
}
@Test
- public void testReceptionHandlerParameters_NullReceptionHandlerClassName() {
- final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
- final ReceptionHandlerParameters rHParameters =
+ void testReceptionHandlerParameters_NullReceptionHandlerClassName() {
+ final var pHParameters = commonTestData.getPluginHandlerParameters(false);
+ final var rHParameters =
new ReceptionHandlerParameters(CommonTestData.RECEPTION_HANDLER_TYPE, null,
CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, pHParameters);
- final ValidationResult validationResult = rHParameters.validate();
+ final var validationResult = rHParameters.validate();
assertEquals(CommonTestData.RECEPTION_HANDLER_TYPE, rHParameters.getReceptionHandlerType());
- assertEquals(null, rHParameters.getReceptionHandlerClassName());
+ assertThat(rHParameters.getReceptionHandlerClassName()).isNull();
assertEquals(CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS,
rHParameters.getReceptionHandlerConfigurationName());
assertEquals(pHParameters, rHParameters.getPluginHandlerParameters());
@@ -88,12 +86,12 @@ public class TestReceptionHandlerParameters {
}
@Test
- public void testReceptionHandlerParameters_EmptyReceptionHandlerType() {
- final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
- final ReceptionHandlerParameters rHParameters =
+ void testReceptionHandlerParameters_EmptyReceptionHandlerType() {
+ final var pHParameters = commonTestData.getPluginHandlerParameters(false);
+ final var rHParameters =
new ReceptionHandlerParameters("", CommonTestData.RECEPTION_HANDLER_CLASS_NAME,
CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, pHParameters);
- final ValidationResult validationResult = rHParameters.validate();
+ final var validationResult = rHParameters.validate();
assertEquals("", rHParameters.getReceptionHandlerType());
assertEquals(CommonTestData.RECEPTION_HANDLER_CLASS_NAME, rHParameters.getReceptionHandlerClassName());
assertEquals(pHParameters, rHParameters.getPluginHandlerParameters());
@@ -102,12 +100,12 @@ public class TestReceptionHandlerParameters {
}
@Test
- public void testReceptionHandlerParameters_EmptyReceptionHandlerClassName() {
- final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
- final ReceptionHandlerParameters rHParameters =
+ void testReceptionHandlerParameters_EmptyReceptionHandlerClassName() {
+ final var pHParameters = commonTestData.getPluginHandlerParameters(false);
+ final var rHParameters =
new ReceptionHandlerParameters(CommonTestData.RECEPTION_HANDLER_TYPE, "",
CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, pHParameters);
- final ValidationResult validationResult = rHParameters.validate();
+ final var validationResult = rHParameters.validate();
assertEquals(CommonTestData.RECEPTION_HANDLER_TYPE, rHParameters.getReceptionHandlerType());
assertEquals("", rHParameters.getReceptionHandlerClassName());
assertEquals(CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS,
@@ -118,24 +116,24 @@ public class TestReceptionHandlerParameters {
}
@Test
- public void testReceptionHandlerParameters_EmptyPluginHandler() {
- final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(true);
- final ReceptionHandlerParameters rHParameters = new ReceptionHandlerParameters(
+ void testReceptionHandlerParameters_EmptyPluginHandler() {
+ final var pHParameters = commonTestData.getPluginHandlerParameters(true);
+ final var rHParameters = new ReceptionHandlerParameters(
CommonTestData.RECEPTION_HANDLER_TYPE, CommonTestData.RECEPTION_HANDLER_CLASS_NAME,
CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, pHParameters);
- ValidationResult result = rHParameters.validate();
+ var result = rHParameters.validate();
assertFalse(result.isValid());
assertThat(result.getResult()).contains("\"policyForwarders\"", "minimum");
}
@Test
- public void testReceptionHandlerParameters_InvalidReceptionHandlerClass() {
- final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
+ void testReceptionHandlerParameters_InvalidReceptionHandlerClass() {
+ final var pHParameters = commonTestData.getPluginHandlerParameters(false);
- final ReceptionHandlerParameters rHParameters = new ReceptionHandlerParameters(
+ final var rHParameters = new ReceptionHandlerParameters(
CommonTestData.RECEPTION_HANDLER_TYPE, CommonTestData.RECEPTION_HANDLER_CLASS_NAME + "Invalid",
CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, pHParameters);
- final ValidationResult validationResult = rHParameters.validate();
+ final var validationResult = rHParameters.validate();
assertEquals(CommonTestData.RECEPTION_HANDLER_TYPE, rHParameters.getReceptionHandlerType());
assertEquals(CommonTestData.RECEPTION_HANDLER_CLASS_NAME + "Invalid",
rHParameters.getReceptionHandlerClassName());
diff --git a/main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java b/main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java
index ce4cda24..4673f383 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java
@@ -25,22 +25,17 @@ package org.onap.policy.distribution.main.rest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;
-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 jakarta.ws.rs.client.ClientBuilder;
+import jakarta.ws.rs.core.MediaType;
import java.io.IOException;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Invocation;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.internal.util.reflection.Whitebox;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.endpoints.http.server.RestServer;
-import org.onap.policy.common.endpoints.parameters.RestServerParameters;
import org.onap.policy.common.endpoints.report.HealthCheckReport;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.common.utils.network.NetworkUtil;
@@ -53,7 +48,7 @@ import org.onap.policy.distribution.main.startstop.Main;
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class TestDistributionRestServer {
+class TestDistributionRestServer {
private static final String NOT_ALIVE = "not alive";
private static final String ALIVE = "alive";
@@ -62,32 +57,31 @@ public class TestDistributionRestServer {
private int port;
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
ParameterService.clear();
}
@Test
- public void testHealthCheckSuccess() throws IOException, InterruptedException {
- final String reportString =
+ void testHealthCheckSuccess() throws IOException, InterruptedException {
+ final var reportString =
"HealthCheckReport(name=Policy SSD, url=" + SELF + ", healthy=true, code=200, message=alive)";
- final Main main = startDistributionService();
- final HealthCheckReport report = performHealthCheck();
+ final var main = startDistributionService();
+ final var report = performHealthCheck();
validateReport(NAME, SELF, true, 200, ALIVE, reportString, report);
assertThatCode(() -> stopDistributionService(main)).doesNotThrowAnyException();
}
@Test
- public void testHealthCheckFailure() throws IOException, InterruptedException {
+ void testHealthCheckFailure() throws IOException, InterruptedException {
port = NetworkUtil.allocPort();
- final String reportString =
+ final var reportString =
"HealthCheckReport(name=Policy SSD, url=" + SELF + ", healthy=false, code=500, message=not alive)";
- final RestServerParameters restServerParams = new CommonTestData().getRestServerParameters(false);
- Whitebox.setInternalState(restServerParams, "port", port);
+ final var restServerParams = new CommonTestData().getRestServerParameters(port);
restServerParams.setName(CommonTestData.DISTRIBUTION_GROUP_NAME);
- final RestServer restServer = new RestServer(restServerParams, null, DistributionRestController.class);
+ final var restServer = new RestServer(restServerParams, null, DistributionRestController.class);
restServer.start();
- final HealthCheckReport report = performHealthCheck();
+ final var report = performHealthCheck();
validateReport(NAME, SELF, false, 500, NOT_ALIVE, reportString, report);
assertTrue(restServer.isAlive());
assertThat(restServer.toString()).startsWith("RestServer(servers=");
@@ -104,16 +98,16 @@ public class TestDistributionRestServer {
main.shutdown();
}
- private HealthCheckReport performHealthCheck() throws InterruptedException, IOException {
- final ClientConfig clientConfig = new ClientConfig();
+ private HealthCheckReport performHealthCheck() throws InterruptedException {
+ final var clientConfig = new ClientConfig();
- final HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic("healthcheck", "zb!XztG34");
+ final var feature = HttpAuthenticationFeature.basic("healthcheck", "zb!XztG34");
clientConfig.register(feature);
- final Client client = ClientBuilder.newClient(clientConfig);
- final WebTarget webTarget = client.target("http://localhost:" + port + "/healthcheck");
+ final var client = ClientBuilder.newClient(clientConfig);
+ final var webTarget = client.target("http://localhost:" + port + "/healthcheck");
- final Invocation.Builder invocationBuilder = webTarget.request(MediaType.APPLICATION_JSON);
+ final var invocationBuilder = webTarget.request(MediaType.APPLICATION_JSON);
CommonTestData.awaitServer(port);
return invocationBuilder.get(HealthCheckReport.class);
diff --git a/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java b/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java
index 82e40ccd..ffe0c8d5 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java
@@ -23,21 +23,16 @@
package org.onap.policy.distribution.main.rest;
import static org.assertj.core.api.Assertions.assertThatCode;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import jakarta.ws.rs.client.ClientBuilder;
+import jakarta.ws.rs.core.MediaType;
import java.io.IOException;
import java.security.SecureRandom;
-import java.util.Properties;
import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManager;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Invocation;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
-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.endpoints.report.HealthCheckReport;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.common.utils.network.NetworkUtil;
@@ -51,7 +46,7 @@ import org.onap.policy.distribution.main.startstop.Main;
*
* @author Libo Zhu (libo.zhu@intel.com)
*/
-public class TestHttpsDistributionRestServer {
+class TestHttpsDistributionRestServer {
private static final String ALIVE = "alive";
private static final String SELF = NetworkUtil.getHostname();
@@ -59,23 +54,23 @@ public class TestHttpsDistributionRestServer {
private int port;
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
ParameterService.clear();
}
@Test
- public void testHttpsHealthCheckSuccess() throws Exception {
- final String reportString =
+ void testHttpsHealthCheckSuccess() throws Exception {
+ final var reportString =
"HealthCheckReport(name=Policy SSD, url=" + SELF + ", healthy=true, code=200, message=alive)";
- final Main main = startDistributionService();
- final HealthCheckReport report = performHealthCheck();
+ final var main = startDistributionService();
+ final var report = performHealthCheck();
validateReport(NAME, SELF, true, 200, ALIVE, reportString, report);
assertThatCode(() -> stopDistributionService(main)).doesNotThrowAnyException();
}
private Main startDistributionService() throws IOException, InterruptedException {
- final Properties systemProps = System.getProperties();
+ final var systemProps = System.getProperties();
systemProps.put("javax.net.ssl.keyStore", new SelfSignedKeyStore().getKeystoreName());
systemProps.put("javax.net.ssl.keyStorePassword", SelfSignedKeyStore.KEYSTORE_PASSWORD);
System.setProperties(systemProps);
@@ -91,19 +86,19 @@ public class TestHttpsDistributionRestServer {
private HealthCheckReport performHealthCheck() throws Exception {
- final TrustManager[] noopTrustManager = NetworkUtil.getAlwaysTrustingManager();
+ final var noopTrustManager = NetworkUtil.getAlwaysTrustingManager();
- final SSLContext sc = SSLContext.getInstance("TLSv1.2");
+ final var sc = SSLContext.getInstance("TLSv1.2");
sc.init(null, noopTrustManager, new SecureRandom());
- final ClientBuilder clientBuilder =
+ final var clientBuilder =
ClientBuilder.newBuilder().sslContext(sc).hostnameVerifier((host, session) -> true);
- final Client client = clientBuilder.build();
- final HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic("healthcheck", "zb!XztG34");
+ final var client = clientBuilder.build();
+ final var feature = HttpAuthenticationFeature.basic("healthcheck", "zb!XztG34");
client.register(feature);
- final WebTarget webTarget = client.target("https://localhost:" + port + "/healthcheck");
+ final var webTarget = client.target("https://localhost:" + port + "/healthcheck");
- final Invocation.Builder invocationBuilder = webTarget.request(MediaType.APPLICATION_JSON);
+ final var invocationBuilder = webTarget.request(MediaType.APPLICATION_JSON);
CommonTestData.awaitServer(port);
return invocationBuilder.get(HealthCheckReport.class);
diff --git a/main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionActivator.java b/main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionActivator.java
index dd498bfa..af0b58e1 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionActivator.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionActivator.java
@@ -22,17 +22,16 @@
package org.onap.policy.distribution.main.startstop;
-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 java.io.IOException;
-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.ParameterService;
import org.onap.policy.distribution.main.PolicyDistributionException;
import org.onap.policy.distribution.main.parameters.CommonTestData;
-import org.onap.policy.distribution.main.parameters.DistributionParameterGroup;
import org.onap.policy.distribution.main.parameters.DistributionParameterHandler;
import org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup;
@@ -41,24 +40,24 @@ import org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParamet
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class TestDistributionActivator {
+class TestDistributionActivator {
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
ParameterService.clear();
}
@Test
- public void testDistributionActivator() throws PolicyDistributionException, IOException {
+ void testDistributionActivator() throws PolicyDistributionException, IOException {
CommonTestData.makeConfigFile("parameters/DistributionConfigParameters.json");
final String[] distributionConfigParameters = { "-c", CommonTestData.CONFIG_FILE };
- final DistributionCommandLineArguments arguments =
+ final var arguments =
new DistributionCommandLineArguments(distributionConfigParameters);
- final DistributionParameterGroup parGroup = new DistributionParameterHandler().getParameters(arguments);
+ final var parGroup = new DistributionParameterHandler().getParameters(arguments);
- final DistributionActivator activator = new DistributionActivator(parGroup);
+ final var activator = new DistributionActivator(parGroup);
activator.initialize();
assertTrue(activator.getDistributionParameterGroup().isValid());
assertTrue(DistributionActivator.isAlive());
diff --git a/main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionCommandLineArguments.java b/main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionCommandLineArguments.java
index 0a0e5fa0..09ab1314 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionCommandLineArguments.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionCommandLineArguments.java
@@ -24,7 +24,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertThrows;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.distribution.main.PolicyDistributionRuntimeException;
/**
@@ -33,49 +33,49 @@ import org.onap.policy.distribution.main.PolicyDistributionRuntimeException;
* @author Adheli Tavares (adheli.tavares@est.tech)
*
*/
-public class TestDistributionCommandLineArguments {
+class TestDistributionCommandLineArguments {
@Test
- public void testDistributionOnlyFileName() {
+ void testDistributionOnlyFileName() {
String[] testArgs = {"src/test/resources/parameters/DistributionConfigParameters.json"};
assertThrows(PolicyDistributionRuntimeException.class, () -> new DistributionCommandLineArguments(testArgs));
}
@Test
- public void testDistributionCommandLineArgumentsException() {
+ void testDistributionCommandLineArgumentsException() {
String[] wrongParams = {"arg1", "nothing", "{\"someJson\":1}"};
assertThrows(PolicyDistributionRuntimeException.class, () -> new DistributionCommandLineArguments(wrongParams));
}
@Test
- public void testValidateFileNameEmpty() {
+ void testValidateFileNameEmpty() {
String[] argsOnlyKeyNoValue = {"-c", ""};
assertValidate(argsOnlyKeyNoValue, "policy-distribution configuration file was not specified as an argument");
}
@Test
- public void testValidateFileNameDoesNotExist() {
+ void testValidateFileNameDoesNotExist() {
String[] fileNameNotExistentArgs = {"-c", "someFileName.json"};
assertValidate(fileNameNotExistentArgs,
"policy-distribution configuration file \"someFileName.json\" does not exist");
}
@Test
- public void testValidateFileNameIsNotFile() {
+ void testValidateFileNameIsNotFile() {
String[] folderAsFileNameArgs = {"-c", "src/test/resources/parameters"};
assertValidate(folderAsFileNameArgs,
"policy-distribution configuration file \"src/test/resources/parameters\" is not a normal file");
}
@Test
- public void testDistributionVersion() {
+ void testDistributionVersion() {
String[] testArgs = {"-v"};
- DistributionCommandLineArguments sutArgs = new DistributionCommandLineArguments(testArgs);
+ var sutArgs = new DistributionCommandLineArguments(testArgs);
assertThat(sutArgs.version()).startsWith("ONAP Policy Framework Distribution Service");
}
private void assertValidate(String[] testArgs, String expectedErrorMsg) {
- DistributionCommandLineArguments sutArgs = new DistributionCommandLineArguments(testArgs);
- assertThatThrownBy(() -> sutArgs.validate()).hasMessage(expectedErrorMsg);
+ var sutArgs = new DistributionCommandLineArguments(testArgs);
+ assertThatThrownBy(sutArgs::validate).hasMessage(expectedErrorMsg);
}
}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/startstop/TestMain.java b/main/src/test/java/org/onap/policy/distribution/main/startstop/TestMain.java
index bdb2ba7d..831b337b 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/startstop/TestMain.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/startstop/TestMain.java
@@ -25,12 +25,12 @@ package org.onap.policy.distribution.main.startstop;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-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 java.io.IOException;
-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.ParameterService;
import org.onap.policy.common.utils.resources.MessageConstants;
import org.onap.policy.distribution.main.PolicyDistributionException;
@@ -42,25 +42,25 @@ import org.onap.policy.distribution.main.parameters.CommonTestData;
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class TestMain {
+class TestMain {
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
ParameterService.clear();
}
@Test
- public void testMain() throws PolicyDistributionException, IOException {
+ void testMain() throws PolicyDistributionException, IOException {
CommonTestData.makeConfigFile("parameters/DistributionConfigParameters.json");
final String[] distributionConfigParameters = { "-c", CommonTestData.CONFIG_FILE };
- final Main main = new Main(distributionConfigParameters);
+ final var main = new Main(distributionConfigParameters);
assertTrue(main.getDistributionParameterGroup().isValid());
assertEquals(CommonTestData.DISTRIBUTION_GROUP_NAME, main.getDistributionParameterGroup().getName());
main.shutdown();
}
@Test
- public void testMain_NoArguments() {
+ void testMain_NoArguments() {
final String[] distributionConfigParameters = {};
assertThatThrownBy(() -> new Main(distributionConfigParameters))
.isInstanceOf(PolicyDistributionRuntimeException.class)
@@ -68,7 +68,7 @@ public class TestMain {
}
@Test
- public void testMain_InvalidArguments() {
+ void testMain_InvalidArguments() {
final String[] distributionConfigParameters = {"parameters/DistributionConfigParameters.json"};
assertThatThrownBy(() -> new Main(distributionConfigParameters))
.isInstanceOf(PolicyDistributionRuntimeException.class)
@@ -76,7 +76,7 @@ public class TestMain {
}
@Test
- public void testMain_Help() {
+ void testMain_Help() {
assertThatCode(() -> {
final String[] distributionConfigParameters =
{ "-h" };
@@ -85,7 +85,7 @@ public class TestMain {
}
@Test
- public void testMain_InvalidParameters() {
+ void testMain_InvalidParameters() {
final String[] distributionConfigParameters =
{"-c", "parameters/DistributionConfigParameters_InvalidName.json"};
assertThatThrownBy(() -> new Main(distributionConfigParameters))