aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-impl
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-08-25 12:30:29 -0400
committerJim Hahn <jrh3@att.com>2020-08-25 14:28:02 -0400
commit59f4f54cdf4c1a5c155360239272da690e8c4a72 (patch)
tree47fc9d91bb83b62f429e1ae8b1587c314f710f41 /models-interactions/model-impl
parent43aaa62cdf9a7dadfb6d688f1fe83c5bd355a86d (diff)
Address more sonar issues in policy-models
Addressed sonar issues: - diamond operator Also removed a number of the "NOSONAR" comments now that we know how to address them without disabling sonar. Issue-ID: POLICY-2714 Change-Id: I440f4fa955968fd911616c2b6ee61b4b4d013821 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-impl')
-rw-r--r--models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java7
-rw-r--r--models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java7
-rw-r--r--models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java7
-rw-r--r--models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java7
-rw-r--r--models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java7
-rw-r--r--models-interactions/model-impl/guard/src/test/java/org/onap/policy/guard/OperationsHistoryTest.java5
-rw-r--r--models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java7
-rw-r--r--models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java7
-rw-r--r--models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestWrapperTest.java7
-rw-r--r--models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseWrapperTest.java7
-rw-r--r--models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java7
-rw-r--r--models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java4
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java2
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java10
14 files changed, 26 insertions, 65 deletions
diff --git a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java
index 3e84a3df2..30d4ed910 100644
--- a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java
+++ b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java
@@ -83,13 +83,10 @@ public class CommonHeaderTest {
copiedCommonHeader.setSubRequestId(commonHeader.getSubRequestId());
copiedCommonHeader.setTimeStamp(commonHeader.getTimeStamp());
- /*
- * Disabling sonar to test equals().
- */
- assertEquals(commonHeader, commonHeader); // NOSONAR
+ assertEquals(commonHeader, (Object) commonHeader);
assertEquals(commonHeader, copiedCommonHeader);
assertNotEquals(commonHeader, null);
- assertNotEquals(commonHeader, "Hello"); // NOSONAR
+ assertNotEquals(commonHeader, (Object) "Hello");
CommonHeader clonedCommonHeader = new CommonHeader(commonHeader);
clonedCommonHeader.setApiVer(commonHeader.getApiVer());
diff --git a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java
index 7d804c869..43686a747 100644
--- a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java
+++ b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java
@@ -72,13 +72,10 @@ public class RequestTest {
copiedRequest.setPayload(request.getPayload());
copiedRequest.setTargetId(request.getTargetId());
- /*
- * Disabling sonar to test equals().
- */
- assertEquals(request, request); // NOSONAR
+ assertEquals(request, (Object) request);
assertEquals(request, copiedRequest);
assertNotEquals(request, null);
- assertNotEquals(request, "Hello"); // NOSONAR
+ assertNotEquals(request, (Object) "Hello");
request.setCommonHeader(null);
assertNotEquals(request, copiedRequest);
diff --git a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java
index ce8b2148d..c79062594 100644
--- a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java
+++ b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java
@@ -55,13 +55,10 @@ public class ResponseStatusTest {
copiedStatus.setDescription(status.getDescription());
copiedStatus.setValue(status.getValue());
- /*
- * Disabling sonar to test equals().
- */
- assertEquals(status, status); // NOSONAR
+ assertEquals(status, (Object) status);
assertEquals(status, copiedStatus);
assertNotEquals(status, null);
- assertNotEquals(status, "Hello"); // NOSONAR
+ assertNotEquals(status, (Object) "Hello");
status.setCode(-1);
assertNotEquals(status, copiedStatus);
diff --git a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java
index 14e14f0f9..9e20331f9 100644
--- a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java
+++ b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java
@@ -67,13 +67,10 @@ public class ResponseTest {
copiedResponse.setStatus(response.getStatus());
copiedResponse.setPayload(response.getPayload());
- /*
- * Disabling sonar to test equals().
- */
- assertEquals(response, response); // NOSONAR
+ assertEquals(response, (Object) response);
assertEquals(response, copiedResponse);
assertNotEquals(response, null);
- assertNotEquals(response, "Hello"); // NOSONAR
+ assertNotEquals(response, (Object) "Hello");
response.setCommonHeader(null);
assertNotEquals(response, copiedResponse);
diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java
index 54eec71b5..eaf4ea93a 100644
--- a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java
+++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java
@@ -35,11 +35,8 @@ public class ControlLoopOperationTest {
public void test() {
ControlLoopOperation operation = new ControlLoopOperation();
- /*
- * Disabling sonar to test equals().
- */
- assertEquals(operation, operation); // NOSONAR
- assertNotEquals(operation, ""); // NOSONAR
+ assertEquals(operation, (Object) operation);
+ assertNotEquals(operation, (Object) "");
assertNotEquals(operation, null);
assertNotEquals(0, operation.hashCode());
diff --git a/models-interactions/model-impl/guard/src/test/java/org/onap/policy/guard/OperationsHistoryTest.java b/models-interactions/model-impl/guard/src/test/java/org/onap/policy/guard/OperationsHistoryTest.java
index 32827b04b..47bdb4c36 100644
--- a/models-interactions/model-impl/guard/src/test/java/org/onap/policy/guard/OperationsHistoryTest.java
+++ b/models-interactions/model-impl/guard/src/test/java/org/onap/policy/guard/OperationsHistoryTest.java
@@ -63,10 +63,7 @@ public class OperationsHistoryTest {
dao.setId(101L);
assertNotEquals(hc, dao.hashCode());
- /*
- * Disabling sonar to test equals().
- */
- assertEquals(dao, dao); // NOSONAR
+ assertEquals(dao, (Object) dao);
assertNotEquals(dao, new OperationsHistory());
}
}
diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java
index 8c7ee6d53..f4c0bf32d 100644
--- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java
+++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java
@@ -77,13 +77,10 @@ public class PciCommonHeaderTest {
copiedPciCommonHeader.setSubRequestId(commonHeader.getSubRequestId());
copiedPciCommonHeader.setTimeStamp(commonHeader.getTimeStamp());
- /*
- * Disabling sonar to test equals().
- */
- assertEquals(commonHeader, commonHeader); // NOSONAR
+ assertEquals(commonHeader, (Object) commonHeader);
assertEquals(commonHeader, copiedPciCommonHeader);
assertNotEquals(commonHeader, null);
- assertNotEquals(commonHeader, "Hello"); // NOSONAR
+ assertNotEquals(commonHeader, (Object) "Hello");
PciCommonHeader clonedPciCommonHeader = new PciCommonHeader(commonHeader);
clonedPciCommonHeader.setApiVer(commonHeader.getApiVer());
diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java
index 7719d0966..0bff14de9 100644
--- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java
+++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java
@@ -59,13 +59,10 @@ public class PciRequestTest {
copiedPciRequest.setAction(request.getAction());
copiedPciRequest.setPayload(request.getPayload());
- /*
- * Disabling sonar to test equals().
- */
- assertEquals(request, request); // NOSONAR
+ assertEquals(request, (Object) request);
assertEquals(request, copiedPciRequest);
assertNotEquals(request, null);
- assertNotEquals(request, "Hello"); // NOSONAR
+ assertNotEquals(request, (Object) "Hello");
request.setCommonHeader(null);
assertNotEquals(request, copiedPciRequest);
diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestWrapperTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestWrapperTest.java
index 65f362378..a5c81bc1a 100644
--- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestWrapperTest.java
+++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestWrapperTest.java
@@ -49,13 +49,10 @@ public class PciRequestWrapperTest {
PciRequestWrapper copiedPciRequestWrapper = new PciRequestWrapper();
copiedPciRequestWrapper.setBody(requestWrapper.getBody());
- /*
- * Disabling sonar to test equals().
- */
- assertEquals(requestWrapper, requestWrapper); // NOSONAR
+ assertEquals(requestWrapper, (Object) requestWrapper);
assertEquals(requestWrapper, copiedPciRequestWrapper);
assertNotEquals(requestWrapper, null);
- assertNotEquals(requestWrapper, "Hello"); // NOSONAR
+ assertNotEquals(requestWrapper, (Object) "Hello");
requestWrapper.setBody(null);
assertNotEquals(requestWrapper, copiedPciRequestWrapper);
diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseWrapperTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseWrapperTest.java
index cb12083f3..eab065500 100644
--- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseWrapperTest.java
+++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseWrapperTest.java
@@ -49,13 +49,10 @@ public class PciResponseWrapperTest {
PciResponseWrapper copiedPciResponseWrapper = new PciResponseWrapper();
copiedPciResponseWrapper.setBody(responseWrapper.getBody());
- /*
- * Disabling sonar to test equals().
- */
- assertEquals(responseWrapper, responseWrapper); // NOSONAR
+ assertEquals(responseWrapper, (Object) responseWrapper);
//assertEquals(responseWrapper, copiedPciResponseWrapper);
assertNotEquals(responseWrapper, null);
- assertNotEquals(responseWrapper, "Hello"); // NOSONAR
+ assertNotEquals(responseWrapper, (Object) "Hello");
responseWrapper.setBody(null);
assertNotEquals(responseWrapper, copiedPciResponseWrapper);
diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java
index 2f6c7f8ba..d496f86fe 100644
--- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java
+++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java
@@ -50,13 +50,10 @@ public class PciStatusTest {
copiedStatus.setCode(status.getCode());
copiedStatus.setValue(status.getValue());
- /*
- * Disabling sonar to test equals().
- */
- assertEquals(status, status); // NOSONAR
+ assertEquals(status, (Object) status);
assertEquals(status, copiedStatus);
assertNotEquals(status, null);
- assertNotEquals(status, "Hello"); // NOSONAR
+ assertNotEquals(status, (Object) "Hello");
status.setCode(-1);
assertNotEquals(status, copiedStatus);
diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java
index d25be8340..914974691 100644
--- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java
+++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java
@@ -68,10 +68,10 @@ public class PciWrapperTest {
copiedPciWrapper.setCorrelationId(wrapper.getCorrelationId());
copiedPciWrapper.setType(wrapper.getType());
- assertEquals(wrapper, wrapper);
+ assertEquals(wrapper, (Object) wrapper);
assertEquals(wrapper, copiedPciWrapper);
assertNotEquals(wrapper, null);
- assertNotEquals(wrapper, "Hello");
+ assertNotEquals(wrapper, (Object) "Hello");
wrapper.setVersion(null);
assertNotEquals(wrapper, copiedPciWrapper);
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java
index f7b663e4b..43d5cd38a 100644
--- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java
@@ -113,7 +113,7 @@ public class SoRequestDetailsTest {
SoRequestDetails copiedDetails = new SoRequestDetails(details);
- assertEquals(details, details);
+ assertEquals(details, (Object) details);
assertEquals(details, copiedDetails);
assertNotEquals(details, null);
assertNotEquals(details, (Object) "Hello");
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java
index e508c44f8..42f57c7e4 100644
--- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java
@@ -72,16 +72,10 @@ public class SoResponseWrapperTest {
SoResponseWrapper identicalResponseWrapper = new SoResponseWrapper(response, requestId);
- /*
- * Disabling sonar because we are purposely checking various branches of the
- * equals() method.
- */
- assertEquals(responseWrapper, responseWrapper); // NOSONAR
+ assertEquals(responseWrapper, (Object) responseWrapper);
assertEquals(responseWrapper, identicalResponseWrapper);
- assertNotEquals(null, responseWrapper);
- assertNotEquals("Hello", responseWrapper); // NOSONAR
assertNotEquals(responseWrapper, null);
- assertNotEquals(responseWrapper, "AString"); // NOSONAR
+ assertNotEquals(responseWrapper, (Object) "AString");
assertEquals(new SoResponseWrapper(null, null), new SoResponseWrapper(null, null));
assertNotEquals(new SoResponseWrapper(null, null), identicalResponseWrapper);