From fad6fa4890538fe8f4cbb96ae3fb0be6767d28d1 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Thu, 27 Jun 2019 14:58:28 +0000 Subject: Fix Sonar/Checkstyle issues in apex-pdp BBS Java code introduced Sonar issues, these are resolved. Also fixed checkstyle errors in other classes. Also fiexed "unexpected type" eclipse errors. Issue-ID: POLICY-1791 Change-Id: I3931051f0944c6d53745c8dd1db7cca4ee118f1c Signed-off-by: liamfallon --- .../org/onap/policy/apex/model/policymodel/concepts/LogicTest.java | 3 ++- .../onap/policy/apex/model/policymodel/concepts/PoliciesTest.java | 5 +++-- .../onap/policy/apex/model/policymodel/concepts/PolicyModelTest.java | 3 ++- .../onap/policy/apex/model/policymodel/concepts/StateOutputTest.java | 3 ++- .../apex/model/policymodel/concepts/StateTaskReferenceTest.java | 3 ++- .../policy/apex/model/policymodel/concepts/TaskParameterTest.java | 3 ++- .../org/onap/policy/apex/model/policymodel/concepts/TasksTest.java | 5 +++-- 7 files changed, 16 insertions(+), 9 deletions(-) (limited to 'model/policy-model/src/test') 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 70db66348..f9f424880 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,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -162,7 +163,7 @@ public class LogicTest { assertTrue(logic.equals(logic)); assertTrue(logic.equals(clonedLogic)); assertFalse(logic.equals(null)); - assertFalse(logic.equals("Hello")); + 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"))); 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 e1264e887..1974413ff 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 @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -240,7 +241,7 @@ public class PoliciesTest { assertTrue(policy.equals(policy)); assertTrue(policy.equals(clonedPolicy)); assertFalse(policy.equals(null)); - assertFalse(policy.equals("Hello")); + assertFalse(policy.equals((Object)"Hello")); assertFalse(policy.equals( new AxPolicy(AxArtifactKey.getNullKey(), savedTemplate, savedStateMap, savedFirstState))); assertFalse(policy.equals(new AxPolicy(savedPolicyKey, "SomeTemplate", savedStateMap, savedFirstState))); @@ -324,7 +325,7 @@ public class PoliciesTest { assertTrue(policies.equals(policies)); assertTrue(policies.equals(clonedPolicies)); assertFalse(policies.equals(null)); - assertFalse(policies.equals("Hello")); + assertFalse(policies.equals((Object)"Hello")); assertFalse(policies.equals(new AxPolicies(new AxArtifactKey()))); assertEquals(0, policies.compareTo(policies)); 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 6c93efde0..d2c6b1bdb 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,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -89,7 +90,7 @@ public class PolicyModelTest { assertTrue(model.equals(model)); assertTrue(model.equals(clonedModel)); - assertFalse(model.equals("Hello")); + assertFalse(model.equals((Object)"Hello")); assertFalse(model.equals(new AxPolicyModel(new AxArtifactKey()))); assertFalse(model.equals(new AxPolicyModel(AxArtifactKey.getNullKey(), new AxContextSchemas(schemasKey), new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), 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 901d641cb..7d1826bd0 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 @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -119,7 +120,7 @@ public class StateOutputTest { assertTrue(so.equals(so)); assertTrue(so.equals(clonedPar)); assertFalse(so.equals(null)); - assertFalse(so.equals("Hello")); + 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()))); 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 cfc8a494e..b37d49030 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 @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -135,7 +136,7 @@ public class StateTaskReferenceTest { assertTrue(stRef.equals(stRef)); assertTrue(stRef.equals(clonedStRef)); assertFalse(stRef.equals(null)); - assertFalse(stRef.equals("Hello")); + assertFalse(stRef.equals((Object)"Hello")); assertFalse(stRef.equals( new AxStateTaskReference(AxReferenceKey.getNullKey(), AxStateTaskOutputType.LOGIC, soKey))); assertFalse(stRef.equals(new AxStateTaskReference(stRefKey, AxStateTaskOutputType.DIRECT, soKey))); 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 ecc8a4f66..fe059724f 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 @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -99,7 +100,7 @@ public class TaskParameterTest { assertTrue(par.equals(par)); assertTrue(par.equals(clonedPar)); assertFalse(par.equals(null)); - assertFalse(par.equals("Hello")); + 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"))); 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 248dd6307..1041d4219 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,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -228,7 +229,7 @@ public class TasksTest { assertTrue(task.equals(task)); assertTrue(task.equals(clonedTask)); assertFalse(task.equals(null)); - assertFalse(task.equals("Hello")); + assertFalse(task.equals((Object)"Hello")); assertFalse(task.equals(new AxTask(new AxArtifactKey(), ifMap, ofMap, tpMap, ctxtSet, tl))); assertFalse(task.equals(new AxTask(taskKey, ifEmptyMap, ofMap, tpMap, ctxtSet, tl))); assertFalse(task.equals(new AxTask(taskKey, ifMap, ofEmptyMap, tpMap, ctxtSet, tl))); @@ -311,7 +312,7 @@ public class TasksTest { assertTrue(tasks.equals(tasks)); assertTrue(tasks.equals(clonedTasks)); assertFalse(tasks.equals(null)); - assertFalse(tasks.equals("Hello")); + assertFalse(tasks.equals((Object)"Hello")); assertFalse(tasks.equals(new AxTasks(new AxArtifactKey()))); assertEquals(0, tasks.compareTo(tasks)); -- cgit 1.2.3-korg