diff options
author | Jim Hahn <jrh3@att.com> | 2020-07-21 09:55:38 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-07-21 16:25:53 -0400 |
commit | 248a660d61fa03caa4710cf8cfe144eb245b807b (patch) | |
tree | 9f7c9aa7fda6d9ab9977bf2398a0136a787dc62a /models-interactions/model-impl/sdc | |
parent | f203526d0f86d385976da394bd1f0f918e4445d9 (diff) |
Fix some sonars in policy-models
Fixed the following sonar issues in some of the project directories:
- use assertNull, assertEquals, etc.
- swap assertEquals arguments
- extract a constant
- don't invoke toString() in logger calls
- TODOs
- generic types
Issue-ID: POLICY-2714
Change-Id: Id8803f9bf617ea9fc173a67b8606600709b55bdc
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-impl/sdc')
4 files changed, 20 insertions, 24 deletions
diff --git a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java index 91ed1e432..fd05affb5 100644 --- a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java +++ b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * sdc * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +22,6 @@ package org.onap.policy.sdc; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import java.util.UUID; import org.junit.Test; @@ -112,8 +111,8 @@ public class ResourceInstanceTest { public void testEquals() { ResourceInstance ri1 = new ResourceInstance(); ResourceInstance ri2 = new ResourceInstance(ri1); - assertTrue(ri1.equals(ri2)); - assertTrue(ri2.equals(ri1)); + assertEquals(ri1, ri2); + assertEquals(ri2, ri1); ri1.setResourceInstanceName(INSTANCE); ri1.setResourceName(RESOURCE); @@ -122,8 +121,8 @@ public class ResourceInstanceTest { ri1.setResourceVersion(VERSION_000); ri1.setResourceType(ResourceType.VL); ri2 = new ResourceInstance(ri1); - assertTrue(ri1.equals(ri2)); - assertTrue(ri2.equals(ri1)); + assertEquals(ri1, ri2); + assertEquals(ri2, ri1); } @Test diff --git a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java index 7b76a9de7..10e26bd9c 100644 --- a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java +++ b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * sdc * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +22,6 @@ package org.onap.policy.sdc; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import java.util.UUID; import org.junit.Test; @@ -119,14 +118,14 @@ public class ResourceTest { public void testEquals() { Resource r1 = new Resource(); Resource r2 = new Resource(r1); - assertTrue(r1.equals(r2)); - assertTrue(r2.equals(r1)); + assertEquals(r1, r2); + assertEquals(r2, r1); r1 = new Resource(UUID.randomUUID(), UUID.randomUUID(), EQUALS_TEST, VERSION_111, ResourceType.VFC); r2 = new Resource(r1); - assertTrue(r1.equals(r2)); - assertTrue(r2.equals(r1)); + assertEquals(r1, r2); + assertEquals(r2, r1); } @Test diff --git a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java index 336370518..ecd0bb323 100644 --- a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java +++ b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * sdc * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +22,6 @@ package org.onap.policy.sdc; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import java.util.UUID; import org.junit.Test; @@ -125,8 +124,8 @@ public class ServiceInstanceTest { public void testEquals() { ServiceInstance si1 = new ServiceInstance(); ServiceInstance si2 = new ServiceInstance(si1); - assertTrue(si1.equals(si2)); - assertTrue(si2.equals(si1)); + assertEquals(si1, si2); + assertEquals(si2, si1); si1.setServiceInstanceName(INSTANCE); si1.setServiceName(SERVICE); @@ -136,8 +135,8 @@ public class ServiceInstanceTest { si1.setWidgetModelUUID(UUID.randomUUID()); si1.setWidgetModelVersion(VERSION_333); si2 = new ServiceInstance(si1); - assertTrue(si1.equals(si2)); - assertTrue(si2.equals(si1)); + assertEquals(si1, si2); + assertEquals(si2, si1); } @Test diff --git a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java index d7913624c..1e6c6f917 100644 --- a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java +++ b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * sdc * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +22,6 @@ package org.onap.policy.sdc; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import java.util.UUID; import org.junit.Test; @@ -107,13 +106,13 @@ public class ServiceTest { public void testEquals() { Service s1 = new Service(); Service s2 = new Service(s1); - assertTrue(s1.equals(s2)); - assertTrue(s2.equals(s1)); + assertEquals(s1, s2); + assertEquals(s2, s1); s1 = new Service(UUID.randomUUID(), UUID.randomUUID(), EQUALS_TEST, VERSION_111); s2 = new Service(s1); - assertTrue(s1.equals(s2)); - assertTrue(s2.equals(s1)); + assertEquals(s1, s2); + assertEquals(s2, s1); } @Test |