diff options
author | waynedunican <wayne.dunican@est.tech> | 2020-07-24 09:46:36 +0100 |
---|---|---|
committer | waynedunican <wayne.dunican@est.tech> | 2020-07-27 13:28:30 +0100 |
commit | b2e2d5f8daeefb08873d11de44cb4cfe7cfab03a (patch) | |
tree | be45f7f5bf18fe4a1a1b1b430a4089a1d1a316c2 /model | |
parent | ba58c5bad6075f7bc902de80190cc6770a209bb6 (diff) |
SONAR assertions apex-pdp
Ensure assertions are present in test cases
Issue-ID: POLICY-2706
Change-Id: I3673a7668564401d2136450b0bdd7a013605dd7c
Signed-off-by: waynedunican <wayne.dunican@est.tech>
Diffstat (limited to 'model')
3 files changed, 15 insertions, 4 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"); |