summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java3
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelSaverTest.java13
-rw-r--r--model/utilities/src/test/java/org/onap/policy/apex/model/utilities/DirectoryUtilsTest.java3
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaRecordTest.java2
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumerTest.java30
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducerTest.java28
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/test/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumerTest.java4
-rw-r--r--services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterConstants.java5
-rw-r--r--services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterMain.java4
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJava.java10
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJavascript.java9
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.java8
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineMvel.java8
-rw-r--r--tools/model-generator/src/test/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2CliTest.java3
-rw-r--r--tools/model-generator/src/test/java/org/onap/policy/apex/tools/model/generator/model2event/Model2EventTest.java3
-rw-r--r--tools/simple-wsclient/src/test/java/org/onap/policy/apex/tools/simple/wsclient/WsClientTest.java3
-rw-r--r--tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/CliParserTest.java3
-rw-r--r--tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersionTest.java5
-rw-r--r--tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java6
19 files changed, 104 insertions, 46 deletions
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java
index f9b949701..e584085c3 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java
@@ -79,8 +79,11 @@ public class EntityTest {
@Test
public void testEntityTestBadVals() throws ApexException {
final DaoParameters daoParameters = new DaoParameters();
+ assertNotNull(daoParameters);
daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao");
+ assertEquals("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao", daoParameters.getPluginClass());
daoParameters.setPersistenceUnit("DaoTest");
+ assertEquals("DaoTest", daoParameters.getPersistenceUnit());
apexDao = new ApexDaoFactory().createApexDao(daoParameters);
apexDao.init(daoParameters);
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelSaverTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelSaverTest.java
index 21be88377..ad897832e 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelSaverTest.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelSaverTest.java
@@ -1,25 +1,28 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
package org.onap.policy.apex.model.basicmodel.handling;
+import static org.junit.Assert.assertNotNull;
+
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
@@ -33,12 +36,14 @@ public class ApexModelSaverTest {
@Test
public void testModelSaver() throws IOException, ApexException {
AxModel model = new DummyApexBasicModelCreator().getModel();
+ assertNotNull(model);
Path tempPath = Files.createTempDirectory("ApexTest");
+ assertNotNull(tempPath);
ApexModelSaver<AxModel> modelSaver = new ApexModelSaver<AxModel>(AxModel.class, model,
tempPath.toAbsolutePath().toString());
-
+ assertNotNull(modelSaver);
modelSaver.apexModelWriteXml();
modelSaver.apexModelWriteJson();
diff --git a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/DirectoryUtilsTest.java b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/DirectoryUtilsTest.java
index 0e9c71c27..69c2d4763 100644
--- a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/DirectoryUtilsTest.java
+++ b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/DirectoryUtilsTest.java
@@ -21,6 +21,8 @@
package org.onap.policy.apex.model.utilities;
+import static org.junit.Assert.assertNotNull;
+
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
@@ -35,6 +37,7 @@ public class DirectoryUtilsTest {
DirectoryUtils.emptyDirectory(new File("/i/dont/exist"));
File tempDir = Files.createTempDirectory("test").toFile();
+ assertNotNull(tempDir);
Files.createTempDirectory(tempDir.toPath(), "testsubprefix");
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaRecordTest.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaRecordTest.java
index 8d85f4ecb..147798227 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaRecordTest.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaRecordTest.java
@@ -23,6 +23,7 @@ package org.onap.policy.apex.plugins.context.schema.avro;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import java.io.IOException;
import org.apache.avro.generic.GenericRecord;
@@ -193,6 +194,7 @@ public class AvroSchemaRecordTest {
public void testVpnRecordReuse() throws IOException {
final AxContextSchema avroSchema =
new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", recordSchemaVpnReuse);
+ assertNotNull(avroSchema);
schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema);
schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema);
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumerTest.java
index a032af650..8591d0470 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumerTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumerTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Samsung. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 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,6 +21,8 @@
package org.onap.policy.apex.plugins.event.carrier.jms;
+import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -58,22 +60,24 @@ public class ApexJmsConsumerTest {
apexJmsProducer = new ApexJmsProducer();
}
- @Test(expected = ApexEventException.class)
+ @Test
public void testInitWithNonJmsCarrierTechnologyParameters() throws ApexEventException {
consumerParameters.setCarrierTechnologyParameters(new CarrierTechnologyParameters() {});
- apexJmsConsumer.init("TestApexJmsConsumer", consumerParameters, incomingEventReceiver);
+ assertThatThrownBy(() -> apexJmsConsumer.init("TestApexJmsConsumer", consumerParameters, incomingEventReceiver))
+ .isInstanceOf(ApexEventException.class);
}
- @Test(expected = ApexEventException.class)
+ @Test
public void testInitWithJmsCarrierTechnologyParameters() throws ApexEventException {
jmsCarrierTechnologyParameters = new JmsCarrierTechnologyParameters();
consumerParameters.setCarrierTechnologyParameters(jmsCarrierTechnologyParameters);
- apexJmsConsumer.init("TestApexJmsConsumer", consumerParameters, incomingEventReceiver);
+ assertThatThrownBy(() -> apexJmsConsumer.init("TestApexJmsConsumer", consumerParameters, incomingEventReceiver))
+ .isInstanceOf(ApexEventException.class);
}
@Test
public void testStart() {
- apexJmsConsumer.start();
+ assertThatCode(apexJmsConsumer::start).doesNotThrowAnyException();
}
@Test
@@ -94,20 +98,20 @@ public class ApexJmsConsumerTest {
assertNotNull(apexJmsConsumer.getPeeredReference(EventHandlerPeeredMode.REQUESTOR));
}
- @Test(expected = ApexEventRuntimeException.class)
+ @Test
public void testRun() {
- apexJmsConsumer.run();
-
+ assertThatThrownBy(apexJmsConsumer::run).isInstanceOf(ApexEventRuntimeException.class);
}
- @Test(expected = ApexEventRuntimeException.class)
+ @Test
public void testOnMessage() {
Message jmsMessage = null;
- apexJmsConsumer.onMessage(jmsMessage);
+ assertThatThrownBy(() -> apexJmsConsumer.onMessage(jmsMessage))
+ .isInstanceOf(ApexEventRuntimeException.class);
}
- @Test(expected = NullPointerException.class)
+ @Test
public void testStop() {
- apexJmsConsumer.stop();
+ assertThatThrownBy(apexJmsConsumer::stop).isInstanceOf(NullPointerException.class);
}
}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducerTest.java
index 34ffc4c75..3783c1ba3 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducerTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducerTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Samsung. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 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,6 +21,8 @@
package org.onap.policy.apex.plugins.event.carrier.jms;
+import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -61,17 +63,19 @@ public class ApexJmsProducerTest {
apexJmsProducer = new ApexJmsProducer();
}
- @Test(expected = ApexEventException.class)
- public void testInitWithNonJmsCarrierTechnologyParameters() throws ApexEventException {
+ @Test
+ public void testInitWithNonJmsCarrierTechnologyParameters() {
producerParameters.setCarrierTechnologyParameters(new CarrierTechnologyParameters() {});
- apexJmsProducer.init("TestApexJmsProducer", producerParameters);
+ assertThatThrownBy(() -> apexJmsProducer.init("TestApexJmsProducer", producerParameters))
+ .isInstanceOf(ApexEventException.class);
}
- @Test(expected = ApexEventException.class)
+ @Test
public void testInitWithJmsCarrierTechnologyParameters() throws ApexEventException {
jmsCarrierTechnologyParameters = new JmsCarrierTechnologyParameters();
producerParameters.setCarrierTechnologyParameters(jmsCarrierTechnologyParameters);
- apexJmsProducer.init("TestApexJmsProducer", producerParameters);
+ assertThatThrownBy(() -> apexJmsProducer.init("TestApexJmsProducer", producerParameters))
+ .isInstanceOf(ApexEventException.class);
}
@Test
@@ -92,7 +96,7 @@ public class ApexJmsProducerTest {
assertNotNull(apexJmsProducer.getPeeredReference(EventHandlerPeeredMode.REQUESTOR));
}
- @Test(expected = NullPointerException.class)
+ @Test
public void testSendEvent() throws ApexEventException {
producerParameters.setCarrierTechnologyParameters(new JmsCarrierTechnologyParameters() {});
synchronousEventCache = new SynchronousEventCache(EventHandlerPeeredMode.SYNCHRONOUS,
@@ -101,21 +105,23 @@ public class ApexJmsProducerTest {
synchronousEventCache);
ApexEvent apexEvent = new ApexEvent("testEvent", "testVersion", "testNameSpace",
"testSource", "testTarget");
- apexJmsProducer.sendEvent(1000L, null, "TestApexJmsProducer", apexEvent);
+ assertThatThrownBy(() -> apexJmsProducer.sendEvent(1000L, null, "TestApexJmsProducer", apexEvent))
+ .isInstanceOf(NullPointerException.class);
}
- @Test(expected = ApexEventRuntimeException.class)
+ @Test
public void testSendEventWithNonSerializableObject() throws ApexEventException {
producerParameters.setCarrierTechnologyParameters(new JmsCarrierTechnologyParameters() {});
synchronousEventCache = new SynchronousEventCache(EventHandlerPeeredMode.SYNCHRONOUS,
apexJmsConsumer, apexJmsProducer, DEFAULT_SYNCHRONOUS_EVENT_TIMEOUT);
apexJmsProducer.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS,
synchronousEventCache);
- apexJmsProducer.sendEvent(-1L, null, "TestApexJmsProducer", new ApexJmsProducerTest());
+ assertThatThrownBy(() -> apexJmsProducer.sendEvent(-1L, null, "TestApexJmsProducer", new ApexJmsProducerTest()))
+ .isInstanceOf(ApexEventRuntimeException.class);
}
@Test
public void testStop() {
- apexJmsProducer.stop();
+ assertThatCode(apexJmsProducer::stop).doesNotThrowAnyException();
}
}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/test/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/test/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumerTest.java
index bbebbc3b8..edb4a1a7b 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/test/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumerTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/test/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumerTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Samsung. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +21,7 @@
package org.onap.policy.apex.plugins.event.carrier.kafka;
+import static org.assertj.core.api.Assertions.assertThatCode;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -57,7 +59,7 @@ public class ApexKafkaConsumerTest {
@Test
public void testStart() {
- apexKafkaConsumer.start();
+ assertThatCode(apexKafkaConsumer::start).doesNotThrowAnyException();
}
@Test
diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterConstants.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterConstants.java
index 520c95650..ab20f4b0c 100644
--- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterConstants.java
+++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterConstants.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2020 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +21,8 @@
package org.onap.policy.apex.services.onappf;
+import static org.assertj.core.api.Assertions.assertThatCode;
+
import org.junit.Test;
import org.powermock.reflect.Whitebox;
@@ -32,6 +35,6 @@ public class TestApexStarterConstants {
@Test
public void test() throws Exception {
// verify that constructor does not throw an exception
- Whitebox.invokeConstructor(ApexStarterConstants.class);
+ assertThatCode(() -> Whitebox.invokeConstructor(ApexStarterConstants.class)).doesNotThrowAnyException();
}
}
diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterMain.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterMain.java
index 927c1c3f3..adcec020b 100644
--- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterMain.java
+++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterMain.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +21,7 @@
package org.onap.policy.apex.services.onappf;
+import static org.assertj.core.api.Assertions.assertThatCode;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -95,7 +97,7 @@ public class TestApexStarterMain {
@Test
public void testApexStarter_Help() {
final String[] apexStarterConfigParameters = { "-h" };
- ApexStarterMain.main(apexStarterConfigParameters);
+ assertThatCode(() -> ApexStarterMain.main(apexStarterConfigParameters)).doesNotThrowAnyException();
}
@Test
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJava.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJava.java
index 1bdd0758c..937a89d9d 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJava.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJava.java
@@ -21,6 +21,8 @@
package org.onap.policy.apex.testsuites.integration.executor.engine;
+import static org.assertj.core.api.Assertions.assertThatCode;
+
import java.io.IOException;
import org.junit.After;
import org.junit.Before;
@@ -96,8 +98,10 @@ public class TestApexEngineJava {
* @throws ApexException the apex exception
*/
@Test
- public void testApexEngineJava() throws InterruptedException, IOException, ApexException {
- new TestApexEngine("JAVA", engineParameters);
- new TestApexEngine("JAVA", engineParameters);
+ public void testApexEngineJava() {
+ assertThatCode(() -> {
+ new TestApexEngine("JAVA", engineParameters);
+ new TestApexEngine("JAVA", engineParameters);
+ }).doesNotThrowAnyException();
}
}
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJavascript.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJavascript.java
index a06c49f7a..108416bca 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJavascript.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJavascript.java
@@ -21,6 +21,8 @@
package org.onap.policy.apex.testsuites.integration.executor.engine;
+import static org.assertj.core.api.Assertions.assertThatCode;
+
import java.io.IOException;
import org.junit.After;
import org.junit.Before;
@@ -95,8 +97,9 @@ public class TestApexEngineJavascript {
*/
@Test
public void testApexEngineJavascript() throws ApexException, InterruptedException, IOException {
-
- new TestApexEngine("JAVASCRIPT", engineParameters);
- new TestApexEngine("JAVASCRIPT", engineParameters);
+ assertThatCode(() -> {
+ new TestApexEngine("JAVASCRIPT", engineParameters);
+ new TestApexEngine("JAVASCRIPT", engineParameters);
+ }).doesNotThrowAnyException();
}
}
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.java
index f62c7e3e7..76b3835a1 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.java
@@ -21,6 +21,8 @@
package org.onap.policy.apex.testsuites.integration.executor.engine;
+import static org.assertj.core.api.Assertions.assertThatCode;
+
import java.io.IOException;
import org.junit.After;
import org.junit.Before;
@@ -98,7 +100,9 @@ public class TestApexEngineJython {
*/
@Test
public void testApexEngineJython() throws ApexException, InterruptedException, IOException {
- new TestApexEngine("JAVASCRIPT", engineParameters);
- new TestApexEngine("JAVASCRIPT", engineParameters);
+ assertThatCode(() -> {
+ new TestApexEngine("JAVASCRIPT", engineParameters);
+ new TestApexEngine("JAVASCRIPT", engineParameters);
+ }).doesNotThrowAnyException();
}
}
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineMvel.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineMvel.java
index bb24ed9e7..499dc59d9 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineMvel.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineMvel.java
@@ -21,6 +21,8 @@
package org.onap.policy.apex.testsuites.integration.executor.engine;
+import static org.assertj.core.api.Assertions.assertThatCode;
+
import java.io.IOException;
import org.junit.After;
import org.junit.Before;
@@ -95,7 +97,9 @@ public class TestApexEngineMvel {
*/
@Test
public void testApexEngineMvel() throws ApexException, InterruptedException, IOException {
- new TestApexEngine("MVEL", engineParameters);
- new TestApexEngine("MVEL", engineParameters);
+ assertThatCode(() -> {
+ new TestApexEngine("MVEL", engineParameters);
+ new TestApexEngine("MVEL", engineParameters);
+ }).doesNotThrowAnyException();
}
}
diff --git a/tools/model-generator/src/test/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2CliTest.java b/tools/model-generator/src/test/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2CliTest.java
index 1263dc4fd..24a9f60ce 100644
--- a/tools/model-generator/src/test/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2CliTest.java
+++ b/tools/model-generator/src/test/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2CliTest.java
@@ -21,6 +21,7 @@
package org.onap.policy.apex.tools.model.generator.model2cli;
+import static org.assertj.core.api.Assertions.assertThatCode;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayOutputStream;
@@ -37,7 +38,7 @@ public class Model2CliTest {
public void testModel2Cli() {
final String[] cliArgs = {"-h"};
- Model2CliMain.main(cliArgs);
+ assertThatCode(() -> Model2CliMain.main(cliArgs)).doesNotThrowAnyException();
}
@Test
diff --git a/tools/model-generator/src/test/java/org/onap/policy/apex/tools/model/generator/model2event/Model2EventTest.java b/tools/model-generator/src/test/java/org/onap/policy/apex/tools/model/generator/model2event/Model2EventTest.java
index 58c860d1c..5e2b05124 100644
--- a/tools/model-generator/src/test/java/org/onap/policy/apex/tools/model/generator/model2event/Model2EventTest.java
+++ b/tools/model-generator/src/test/java/org/onap/policy/apex/tools/model/generator/model2event/Model2EventTest.java
@@ -21,6 +21,7 @@
package org.onap.policy.apex.tools.model.generator.model2event;
+import static org.assertj.core.api.Assertions.assertThatCode;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayOutputStream;
@@ -38,7 +39,7 @@ public class Model2EventTest {
final String[] EventArgs =
{ "-h" };
- Model2EventMain.main(EventArgs);
+ assertThatCode(() -> Model2EventMain.main(EventArgs)).doesNotThrowAnyException();
}
diff --git a/tools/simple-wsclient/src/test/java/org/onap/policy/apex/tools/simple/wsclient/WsClientTest.java b/tools/simple-wsclient/src/test/java/org/onap/policy/apex/tools/simple/wsclient/WsClientTest.java
index 8ff185504..6faafe759 100644
--- a/tools/simple-wsclient/src/test/java/org/onap/policy/apex/tools/simple/wsclient/WsClientTest.java
+++ b/tools/simple-wsclient/src/test/java/org/onap/policy/apex/tools/simple/wsclient/WsClientTest.java
@@ -21,6 +21,7 @@
package org.onap.policy.apex.tools.simple.wsclient;
+import static org.assertj.core.api.Assertions.assertThatCode;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayInputStream;
@@ -38,7 +39,7 @@ public class WsClientTest {
final String[] EventArgs =
{ "-h" };
- WsClientMain.main(EventArgs);
+ assertThatCode(() -> WsClientMain.main(EventArgs)).doesNotThrowAnyException();
}
@Test
diff --git a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/CliParserTest.java b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/CliParserTest.java
index ab14c66c5..80980bb34 100644
--- a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/CliParserTest.java
+++ b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/CliParserTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@ package org.onap.policy.apex.tools.common;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertNotNull;
import org.apache.commons.cli.Option;
import org.junit.Test;
@@ -42,6 +44,7 @@ public class CliParserTest {
@Test
public void testappVersion() {
final CliParser cli = new CliParser();
+ assertNotNull(cli);
LOGGER.info(cli.getAppVersion());
}
diff --git a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersionTest.java b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersionTest.java
index 2433e3c5c..1dc8d53ef 100644
--- a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersionTest.java
+++ b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersionTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,13 +21,14 @@
package org.onap.policy.apex.tools.common.docs;
+import static org.junit.Assert.assertNotNull;
+
////
//// NOTE: This file contains tags for ASCIIDOC
//// DO NOT REMOVE any of those tag lines, e.g.
////// tag::**
////// end::**
////
-
import org.apache.commons.cli.CommandLine;
import org.junit.Test;
import org.onap.policy.apex.tools.common.CliOptions;
@@ -51,6 +53,7 @@ public class ExampleAppVersionTest {
// tag::setupParser[]
final CliParser cli = new CliParser();
cli.addOption(CliOptions.VERSION);
+ assertNotNull(cli.getOptions());
final CommandLine cmd = cli.parseCli(args);
// end::setupParser[]
diff --git a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java
index 797c7c1e8..c653cd0b2 100644
--- a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java
+++ b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +21,8 @@
package org.onap.policy.apex.tools.common.docs;
+import static org.junit.Assert.assertNotNull;
+
////
////NOTE: This file contains tags for ASCIIDOC
////DO NOT REMOVE any of those tag lines, e.g.
@@ -28,7 +31,6 @@ package org.onap.policy.apex.tools.common.docs;
////
////DO NOT auto-refresh imports or organise imports!
////
-
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.HelpFormatter;
import org.junit.Test;
@@ -62,9 +64,11 @@ public class ExampleCliParserTest {
// tag::setCli[]
final CliParser cli = new CliParser();
+ assertNotNull(cli);
cli.addOption(CliOptions.HELP);
cli.addOption(CliOptions.VERSION);
cli.addOption(CliOptions.MODELFILE);
+ assertNotNull(cli.getOptions());
// end::setCli[]
// tag::parseCli[]