diff options
author | JvD_Ericsson <jeff.van.dam@est.tech> | 2020-07-17 13:18:37 +0100 |
---|---|---|
committer | JvD_Ericsson <jeff.van.dam@est.tech> | 2020-07-17 16:19:28 +0100 |
commit | 025d5085d56bd1afc60ea8ad0c339655ca373f28 (patch) | |
tree | c36896502a7e0e9d182770a0d94afc8e216a0f17 /model/policy-model/src | |
parent | 28eced32d2acdf731f7782e14f37bf2ea8c98019 (diff) |
Fix assertTrue SONAR issues in apex-pdp/model
Replace assertTrue with assertEquals and assertFalse with
assertNotEquals in apex-pdp/model
Issue-ID: POLICY-2690
Change-Id: Id37989ea8a6ad7b3156e13851cc072ce6c53c03e
Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
Diffstat (limited to 'model/policy-model/src')
8 files changed, 116 insertions, 131 deletions
diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/LogicTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/LogicTest.java index d3d533400..655df059a 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/LogicTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/LogicTest.java @@ -1,20 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. 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. * 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========================================================= */ @@ -22,10 +22,8 @@ package org.onap.policy.apex.model.policymodel.concepts; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import org.junit.Test; @@ -36,7 +34,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.Validat /** * Test apex logic. - * + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class LogicTest { @@ -154,16 +152,16 @@ public class LogicTest { + "parentLocalName=PLN,localName=LN),logicFlavour=LogicFlavour,logic=Logic)", clonedLogic.toString()); - assertFalse(logic.hashCode() == 0); + assertNotEquals(0, logic.hashCode()); - assertTrue(logic.equals(logic)); - assertTrue(logic.equals(clonedLogic)); - assertFalse(logic.equals(null)); - assertFalse(logic.equals((Object) "Hello")); - assertFalse(logic.equals(new AxLogic(AxReferenceKey.getNullKey(), "LogicFlavour", "Logic"))); - assertFalse(logic.equals(new AxLogic(logicKey, "AnotherLogicFlavour", "Logic"))); - assertFalse(logic.equals(new AxLogic(logicKey, "LogicFlavour", "AnotherLogic"))); - assertTrue(logic.equals(new AxLogic(logicKey, "LogicFlavour", "Logic"))); + assertEquals(logic, logic); + assertEquals(logic, clonedLogic); + assertNotNull(logic); + assertNotEquals(logic, (Object) "Hello"); + assertNotEquals(logic, new AxLogic(AxReferenceKey.getNullKey(), "LogicFlavour", "Logic")); + assertNotEquals(logic, new AxLogic(logicKey, "AnotherLogicFlavour", "Logic")); + assertNotEquals(logic, new AxLogic(logicKey, "LogicFlavour", "AnotherLogic")); + assertEquals(logic, new AxLogic(logicKey, "LogicFlavour", "Logic")); assertEquals(0, logic.compareTo(logic)); assertEquals(0, logic.compareTo(clonedLogic)); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PoliciesTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PoliciesTest.java index 084623f6f..662b8bd02 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PoliciesTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PoliciesTest.java @@ -23,10 +23,8 @@ package org.onap.policy.apex.model.policymodel.concepts; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import java.util.Map; import java.util.TreeMap; @@ -40,7 +38,7 @@ import org.onap.policy.apex.model.policymodel.handling.SupportApexPolicyModelCre /** * Test apex policies. - * + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class PoliciesTest { @@ -210,18 +208,18 @@ public class PoliciesTest { assertEquals("AxPolicy:(key=AxArtifactKey:(name=policy,version=0.0.1),template=FREEFORM,sta", clonedPolicy.toString().substring(0, 77)); - assertFalse(policyPN.hashCode() == 0); + assertNotEquals(0, policyPN.hashCode()); - assertTrue(policyPN.equals(policyPN)); - assertTrue(policyPN.equals(clonedPolicy)); - assertFalse(policyPN.equals(null)); - assertFalse(policyPN.equals((Object) "Hello")); - assertFalse(policyPN.equals( - new AxPolicy(AxArtifactKey.getNullKey(), savedTemplate, savedStateMap, savedFirstState))); - assertFalse(policyPN.equals(new AxPolicy(savedPolicyKey, "SomeTemplate", savedStateMap, savedFirstState))); - assertFalse(policyPN.equals(new AxPolicy(savedPolicyKey, savedTemplate, stateMapEmpty, savedFirstState))); - assertFalse(policyPN.equals(new AxPolicy(savedPolicyKey, savedTemplate, savedStateMap, "SomeFirstState"))); - assertTrue(policyPN.equals(new AxPolicy(savedPolicyKey, savedTemplate, savedStateMap, savedFirstState))); + assertEquals(policyPN, policyPN); + assertEquals(policyPN, clonedPolicy); + assertNotNull(policyPN); + assertNotEquals(policyPN, (Object) "Hello"); + assertNotEquals(policyPN, + new AxPolicy(AxArtifactKey.getNullKey(), savedTemplate, savedStateMap, savedFirstState)); + assertNotEquals(policyPN, new AxPolicy(savedPolicyKey, "SomeTemplate", savedStateMap, savedFirstState)); + assertNotEquals(policyPN, new AxPolicy(savedPolicyKey, savedTemplate, stateMapEmpty, savedFirstState)); + assertNotEquals(policyPN, new AxPolicy(savedPolicyKey, savedTemplate, savedStateMap, "SomeFirstState")); + assertEquals(policyPN, new AxPolicy(savedPolicyKey, savedTemplate, savedStateMap, savedFirstState)); assertEquals(0, policyPN.compareTo(policyPN)); assertEquals(0, policyPN.compareTo(clonedPolicy)); @@ -295,13 +293,13 @@ public class PoliciesTest { assertEquals("AxPolicies:(key=AxArtifactKey:(name=PoliciesKey,version=0.0.", clonedPolicies.toString().substring(0, 60)); - assertFalse(policies.hashCode() == 0); + assertNotEquals(0, policies.hashCode()); - assertTrue(policies.equals(policies)); - assertTrue(policies.equals(clonedPolicies)); - assertFalse(policies.equals(null)); - assertFalse(policies.equals((Object) "Hello")); - assertFalse(policies.equals(new AxPolicies(new AxArtifactKey()))); + assertEquals(policies, policies); + assertEquals(policies, clonedPolicies); + assertNotNull(policies); + assertNotEquals(policies, (Object) "Hello"); + assertNotEquals(policies, new AxPolicies(new AxArtifactKey())); assertEquals(0, policies.compareTo(policies)); assertEquals(0, policies.compareTo(clonedPolicies)); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PolicyModelTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PolicyModelTest.java index 820f2d1e6..829f93342 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PolicyModelTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PolicyModelTest.java @@ -1,20 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. 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. * 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========================================================= */ @@ -22,10 +22,8 @@ package org.onap.policy.apex.model.policymodel.concepts; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; @@ -44,7 +42,7 @@ import org.onap.policy.apex.model.policymodel.handling.SupportApexPolicyModelCre /** * Test policy models. - * + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class PolicyModelTest { @@ -79,36 +77,36 @@ public class PolicyModelTest { final AxPolicyModel clonedModel = new AxPolicyModel(model); - assertFalse(model.hashCode() == 0); + assertNotEquals(0, model.hashCode()); - assertTrue(model.equals(model)); - assertTrue(model.equals(clonedModel)); - assertFalse(model.equals((Object) "Hello")); - assertFalse(model.equals(new AxPolicyModel(new AxArtifactKey()))); - assertFalse(model.equals(new AxPolicyModel(AxArtifactKey.getNullKey(), new AxContextSchemas(schemasKey), + assertEquals(model, model); + assertEquals(model, clonedModel); + assertNotEquals(model, (Object) "Hello"); + assertNotEquals(model, new AxPolicyModel(new AxArtifactKey())); + assertNotEquals(model, new AxPolicyModel(AxArtifactKey.getNullKey(), new AxContextSchemas(schemasKey), new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), - new AxTasks(tasksKey), new AxPolicies(policiesKey)))); - assertFalse(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(), new AxKeyInformation(keyInfoKey), + new AxTasks(tasksKey), new AxPolicies(policiesKey))); + assertNotEquals(model, new AxPolicyModel(modelKey, new AxContextSchemas(), new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), - new AxPolicies(policiesKey)))); - assertFalse(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), new AxKeyInformation(), + new AxPolicies(policiesKey))); + assertNotEquals(model, new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), new AxKeyInformation(), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), - new AxPolicies(policiesKey)))); - assertFalse(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), + new AxPolicies(policiesKey))); + assertNotEquals(model, new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), new AxKeyInformation(keyInfoKey), new AxEvents(), new AxContextAlbums(albumsKey), - new AxTasks(tasksKey), new AxPolicies(policiesKey)))); - assertFalse(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), + new AxTasks(tasksKey), new AxPolicies(policiesKey))); + assertNotEquals(model, new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(), - new AxTasks(tasksKey), new AxPolicies(policiesKey)))); - assertFalse(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), + new AxTasks(tasksKey), new AxPolicies(policiesKey))); + assertNotEquals(model, new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), - new AxTasks(), new AxPolicies(policiesKey)))); - assertFalse(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), + new AxTasks(), new AxPolicies(policiesKey))); + assertNotEquals(model, new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), - new AxTasks(tasksKey), new AxPolicies()))); - assertTrue(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), + new AxTasks(tasksKey), new AxPolicies())); + assertEquals(model, new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), - new AxTasks(tasksKey), new AxPolicies(policiesKey)))); + new AxTasks(tasksKey), new AxPolicies(policiesKey))); assertEquals(0, model.compareTo(model)); assertEquals(0, model.compareTo(clonedModel)); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateOutputTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateOutputTest.java index 77ce93d4c..ff3267c8c 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateOutputTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateOutputTest.java @@ -23,10 +23,8 @@ package org.onap.policy.apex.model.policymodel.concepts; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; @@ -99,16 +97,16 @@ public class StateOutputTest { final AxStateOutput clonedPar = new AxStateOutput(so); assertEquals("AxStateOutput:(stateKey=AxReferenceKey:(parentKeyN", clonedPar.toString().substring(0, 50)); - assertFalse(so.hashCode() == 0); + assertNotEquals(0, so.hashCode()); - assertTrue(so.equals(so)); - assertTrue(so.equals(clonedPar)); - assertFalse(so.equals(null)); - assertFalse(so.equals((Object) "Hello")); - assertFalse(so.equals(new AxStateOutput(AxReferenceKey.getNullKey(), eKey, nsKey))); - assertFalse(so.equals(new AxStateOutput(soKey, new AxArtifactKey(), nsKey))); - assertFalse(so.equals(new AxStateOutput(soKey, eKey, new AxReferenceKey()))); - assertTrue(so.equals(new AxStateOutput(soKey, eKey, nsKey))); + assertEquals(so, so); + assertEquals(so, clonedPar); + assertNotNull(so); + assertNotEquals(so, (Object) "Hello"); + assertNotEquals(so, new AxStateOutput(AxReferenceKey.getNullKey(), eKey, nsKey)); + assertNotEquals(so, new AxStateOutput(soKey, new AxArtifactKey(), nsKey)); + assertNotEquals(so, new AxStateOutput(soKey, eKey, new AxReferenceKey())); + assertEquals(so, new AxStateOutput(soKey, eKey, nsKey)); assertEquals(0, so.compareTo(so)); assertEquals(0, so.compareTo(clonedPar)); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTaskReferenceTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTaskReferenceTest.java index aa5dd6109..31012c68c 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTaskReferenceTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTaskReferenceTest.java @@ -23,10 +23,8 @@ package org.onap.policy.apex.model.policymodel.concepts; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; @@ -114,18 +112,17 @@ public class StateTaskReferenceTest { AxStateTaskReference clonedStRef = new AxStateTaskReference(stRef); assertEquals("AxStateTaskReference:(stateKey=AxReferenceKey:(par", clonedStRef.toString().substring(0, 50)); - assertFalse(stRef.hashCode() == 0); - - assertTrue(stRef.equals(stRef)); - assertTrue(stRef.equals(clonedStRef)); - assertFalse(stRef.equals(null)); - assertFalse(stRef.equals((Object) "Hello")); - assertFalse(stRef.equals( - new AxStateTaskReference(AxReferenceKey.getNullKey(), AxStateTaskOutputType.LOGIC, soKey))); - assertFalse(stRef.equals(new AxStateTaskReference(stRefKey, AxStateTaskOutputType.DIRECT, soKey))); - assertFalse(stRef - .equals(new AxStateTaskReference(stRefKey, AxStateTaskOutputType.LOGIC, new AxReferenceKey()))); - assertTrue(stRef.equals(new AxStateTaskReference(stRefKey, AxStateTaskOutputType.LOGIC, soKey))); + assertNotEquals(0, stRef.hashCode()); + + assertEquals(stRef, stRef); + assertEquals(stRef, clonedStRef); + assertNotNull(stRef); + assertNotEquals(stRef, (Object) "Hello"); + assertNotEquals(stRef, new AxStateTaskReference(AxReferenceKey.getNullKey(), AxStateTaskOutputType.LOGIC, + soKey)); + assertNotEquals(stRef, new AxStateTaskReference(stRefKey, AxStateTaskOutputType.DIRECT, soKey)); + assertNotEquals(stRef, new AxStateTaskReference(stRefKey, AxStateTaskOutputType.LOGIC, new AxReferenceKey())); + assertEquals(stRef, new AxStateTaskReference(stRefKey, AxStateTaskOutputType.LOGIC, soKey)); assertNotNull(new AxStateTaskReference(new AxReferenceKey(), new AxArtifactKey(), AxStateTaskOutputType.UNDEFINED, new AxReferenceKey())); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTest.java index ef015e798..4c5ad4ad3 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTest.java @@ -23,10 +23,8 @@ package org.onap.policy.apex.model.policymodel.concepts; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import java.util.Set; import java.util.TreeMap; @@ -384,40 +382,40 @@ public class StateTest { final AxState clonedState = new AxState(state); assertEquals("AxState:(stateKey=AxReferenceKey:(parent", clonedState.toString().substring(0, 40)); - assertFalse(state.hashCode() == 0); + assertNotEquals(0, state.hashCode()); - assertTrue(state.equals(state)); - assertTrue(state.equals(clonedState)); - assertFalse(state.equals(null)); - assertFalse(state.equals((Object) "Hello")); - assertFalse(state.equals(new AxState(new AxStateParamsBuilder().key(new AxReferenceKey()).trigger(triggerKey) + assertEquals(state, state); + assertEquals(state, clonedState); + assertNotNull(state); + assertNotEquals(state, (Object) "Hello"); + assertNotEquals(state, new AxState(new AxStateParamsBuilder().key(new AxReferenceKey()).trigger(triggerKey) .stateOutputs(soMap).contextAlbumReferenceSet(ctxtSet).taskSelectionLogic(tsl) - .stateFinalizerLogicMap(sflMap).defaultTask(defTaskKey).taskReferenceMap(trMap)))); - assertFalse(state.equals(new AxState(new AxStateParamsBuilder().key(stateKey).trigger(new AxArtifactKey()) + .stateFinalizerLogicMap(sflMap).defaultTask(defTaskKey).taskReferenceMap(trMap))); + assertNotEquals(state, new AxState(new AxStateParamsBuilder().key(stateKey).trigger(new AxArtifactKey()) .stateOutputs(soMap).contextAlbumReferenceSet(ctxtSet).taskSelectionLogic(tsl) - .stateFinalizerLogicMap(sflMap).defaultTask(defTaskKey).taskReferenceMap(trMap)))); - assertFalse(state.equals(new AxState(new AxStateParamsBuilder().key(stateKey).trigger(triggerKey) + .stateFinalizerLogicMap(sflMap).defaultTask(defTaskKey).taskReferenceMap(trMap))); + assertNotEquals(state, new AxState(new AxStateParamsBuilder().key(stateKey).trigger(triggerKey) .stateOutputs(soEmptyMap).contextAlbumReferenceSet(ctxtSet).taskSelectionLogic(tsl) - .stateFinalizerLogicMap(sflMap).defaultTask(defTaskKey).taskReferenceMap(trMap)))); - assertFalse(state.equals(new AxState(new AxStateParamsBuilder().key(stateKey).trigger(triggerKey) + .stateFinalizerLogicMap(sflMap).defaultTask(defTaskKey).taskReferenceMap(trMap))); + assertNotEquals(state, new AxState(new AxStateParamsBuilder().key(stateKey).trigger(triggerKey) .stateOutputs(soMap).contextAlbumReferenceSet(ctxtEmptySet).taskSelectionLogic(tsl) - .stateFinalizerLogicMap(sflMap).defaultTask(defTaskKey).taskReferenceMap(trMap)))); - assertFalse(state.equals(new AxState(new AxStateParamsBuilder().key(stateKey).trigger(triggerKey) + .stateFinalizerLogicMap(sflMap).defaultTask(defTaskKey).taskReferenceMap(trMap))); + assertNotEquals(state, new AxState(new AxStateParamsBuilder().key(stateKey).trigger(triggerKey) .stateOutputs(soMap).contextAlbumReferenceSet(ctxtSet) .taskSelectionLogic(new AxTaskSelectionLogic()).stateFinalizerLogicMap(sflMap) - .defaultTask(defTaskKey).taskReferenceMap(trMap)))); - assertFalse(state.equals(new AxState(new AxStateParamsBuilder().key(stateKey).trigger(triggerKey) + .defaultTask(defTaskKey).taskReferenceMap(trMap))); + assertNotEquals(state, new AxState(new AxStateParamsBuilder().key(stateKey).trigger(triggerKey) .stateOutputs(soMap).contextAlbumReferenceSet(ctxtSet).taskSelectionLogic(tsl) - .stateFinalizerLogicMap(sflEmptyMap).defaultTask(defTaskKey).taskReferenceMap(trMap)))); - assertFalse(state.equals(new AxState(new AxStateParamsBuilder().key(stateKey).trigger(triggerKey) + .stateFinalizerLogicMap(sflEmptyMap).defaultTask(defTaskKey).taskReferenceMap(trMap))); + assertNotEquals(state, new AxState(new AxStateParamsBuilder().key(stateKey).trigger(triggerKey) .stateOutputs(soMap).contextAlbumReferenceSet(ctxtSet).taskSelectionLogic(tsl) - .stateFinalizerLogicMap(sflMap).defaultTask(new AxArtifactKey()).taskReferenceMap(trMap)))); - assertFalse(state.equals(new AxState(new AxStateParamsBuilder().key(stateKey).trigger(triggerKey) - .stateOutputs(soMap).contextAlbumReferenceSet(ctxtSet).taskSelectionLogic(tsl) - .stateFinalizerLogicMap(sflMap).defaultTask(defTaskKey).taskReferenceMap(trEmptyMap)))); - assertTrue(state.equals(new AxState(new AxStateParamsBuilder().key(stateKey).trigger(triggerKey) + .stateFinalizerLogicMap(sflMap).defaultTask(new AxArtifactKey()).taskReferenceMap(trMap))); + assertNotEquals(state, new AxState(new AxStateParamsBuilder().key(stateKey).trigger(triggerKey) .stateOutputs(soMap).contextAlbumReferenceSet(ctxtSet).taskSelectionLogic(tsl) - .stateFinalizerLogicMap(sflMap).defaultTask(defTaskKey).taskReferenceMap(trMap)))); + .stateFinalizerLogicMap(sflMap).defaultTask(defTaskKey).taskReferenceMap(trEmptyMap))); + assertEquals(state, new AxState(new AxStateParamsBuilder().key(stateKey).trigger(triggerKey) + .stateOutputs(soMap).contextAlbumReferenceSet(ctxtSet).taskSelectionLogic(tsl) + .stateFinalizerLogicMap(sflMap).defaultTask(defTaskKey).taskReferenceMap(trMap))); assertEquals(0, state.compareTo(state)); assertEquals(0, state.compareTo(clonedState)); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TaskParameterTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TaskParameterTest.java index 3dcc5e8d7..e14dec059 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TaskParameterTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TaskParameterTest.java @@ -23,10 +23,8 @@ package org.onap.policy.apex.model.policymodel.concepts; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import org.junit.Test; @@ -37,7 +35,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.Validat /** * Test task parameters. - * + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TaskParameterTest { @@ -90,15 +88,15 @@ public class TaskParameterTest { assertEquals("AxTaskParameter:(key=AxReferenceKey:(parentKeyName=ParParentName,parentKeyVersion=0.0.1," + "parentLocalName=PLN,localName=LN),defaultValue=DefaultValue)", clonedPar.toString()); - assertFalse(par.hashCode() == 0); + assertNotEquals(0, par.hashCode()); - assertTrue(par.equals(par)); - assertTrue(par.equals(clonedPar)); - assertFalse(par.equals(null)); - assertFalse(par.equals((Object) "Hello")); - assertFalse(par.equals(new AxTaskParameter(AxReferenceKey.getNullKey(), "DefaultValue"))); - assertFalse(par.equals(new AxTaskParameter(parKey, "OtherDefaultValue"))); - assertTrue(par.equals(new AxTaskParameter(parKey, "DefaultValue"))); + assertEquals(par, par); + assertEquals(par, clonedPar); + assertNotNull(par); + assertNotEquals(par, (Object) "Hello"); + assertNotEquals(par, new AxTaskParameter(AxReferenceKey.getNullKey(), "DefaultValue")); + assertNotEquals(par, new AxTaskParameter(parKey, "OtherDefaultValue")); + assertEquals(par, new AxTaskParameter(parKey, "DefaultValue")); assertEquals(0, par.compareTo(par)); assertEquals(0, par.compareTo(clonedPar)); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TasksTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TasksTest.java index 9089e1837..17601c878 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TasksTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TasksTest.java @@ -1,20 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. 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. * 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========================================================= */ @@ -40,7 +40,7 @@ import org.onap.policy.apex.model.eventmodel.concepts.AxOutputField; /** * Test policy tasks. - * + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TasksTest { |