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/so/src/test | |
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/so/src/test')
17 files changed, 100 insertions, 101 deletions
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java index 8d0fdb24c..4aa2db37c 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java @@ -3,7 +3,7 @@ * so * ================================================================================ * - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved + * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,7 @@ package org.onap.policy.so; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNull; import java.time.LocalDateTime; import org.junit.Test; @@ -34,13 +34,13 @@ public class SoAsyncRequestStatusTest { public void testConstructor() { SoAsyncRequestStatus obj = new SoAsyncRequestStatus(); - assertTrue(obj.getCorrelator() == null); - assertTrue(obj.getFinishTime() == null); - assertTrue(obj.getInstanceReferences() == null); - assertTrue(obj.getRequestId() == null); - assertTrue(obj.getRequestScope() == null); - assertTrue(obj.getRequestStatus() == null); - assertTrue(obj.getStartTime() == null); + assertNull(obj.getCorrelator()); + assertNull(obj.getFinishTime()); + assertNull(obj.getInstanceReferences()); + assertNull(obj.getRequestId()); + assertNull(obj.getRequestScope()); + assertNull(obj.getRequestStatus()); + assertNull(obj.getStartTime()); } @Test diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java index 58b3943e4..59626f45d 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java @@ -3,7 +3,7 @@ * so * ================================================================================ * - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved + * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,7 @@ package org.onap.policy.so; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNull; import org.junit.Test; @@ -33,8 +33,8 @@ public class SoCloudConfigurationTest { public void testConstructor() { SoCloudConfiguration obj = new SoCloudConfiguration(); - assertTrue(obj.getLcpCloudRegionId() == null); - assertTrue(obj.getTenantId() == null); + assertNull(obj.getLcpCloudRegionId()); + assertNull(obj.getTenantId()); } @Test diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java index 0b0aa5f03..b8e01c6c1 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java @@ -2,8 +2,7 @@ * ============LICENSE_START======================================================= * so * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 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"); @@ -23,7 +22,7 @@ package org.onap.policy.so; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNull; import org.junit.Test; @@ -33,8 +32,8 @@ public class SoInstanceReferencesTest { public void testConstructor() { SoInstanceReferences obj = new SoInstanceReferences(); - assertTrue(obj.getInstanceId() == null); - assertTrue(obj.getRequestId() == null); + assertNull(obj.getInstanceId()); + assertNull(obj.getRequestId()); } @Test diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java index 60b86bf01..a9f5baaba 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java @@ -3,7 +3,7 @@ * so * ================================================================================ * - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved + * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,7 @@ package org.onap.policy.so; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNull; import org.junit.Test; @@ -33,13 +33,13 @@ public class SoModelInfoTest { public void testConstructor() { SoModelInfo obj = new SoModelInfo(); - assertTrue(obj.getModelCustomizationId() == null); - assertTrue(obj.getModelCustomizationName() == null); - assertTrue(obj.getModelInvariantId() == null); - assertTrue(obj.getModelName() == null); - assertTrue(obj.getModelType() == null); - assertTrue(obj.getModelVersion() == null); - assertTrue(obj.getModelVersionId() == null); + assertNull(obj.getModelCustomizationId()); + assertNull(obj.getModelCustomizationName()); + assertNull(obj.getModelInvariantId()); + assertNull(obj.getModelName()); + assertNull(obj.getModelType()); + assertNull(obj.getModelVersion()); + assertNull(obj.getModelVersionId()); } @Test diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java index 3511d1349..e6fc8fee9 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * so * ================================================================================ - * 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,7 @@ package org.onap.policy.so; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNull; import org.junit.Test; @@ -32,8 +32,8 @@ public class SoPolicyExceptionHolderTest { public void testConstructor() { SoPolicyExceptionHolder obj = new SoPolicyExceptionHolder(); - assertTrue(obj.getMessageId() == null); - assertTrue(obj.getText() == null); + assertNull(obj.getMessageId()); + assertNull(obj.getText()); } @Test diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java index bad45ebc8..b6c2e0671 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java @@ -3,7 +3,7 @@ * so * ================================================================================ * - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved + * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,7 @@ package org.onap.policy.so; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNull; import org.junit.Test; @@ -33,7 +33,7 @@ public class SoRelatedInstanceListElementTest { public void testConstructor() { SoRelatedInstanceListElement obj = new SoRelatedInstanceListElement(); - assertTrue(obj.getRelatedInstance() == null); + assertNull(obj.getRelatedInstance()); } @Test diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java index 72afdda3f..f215d0184 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * so * ================================================================================ - * 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,7 @@ package org.onap.policy.so; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNull; import org.junit.Test; @@ -32,9 +32,9 @@ public class SoRelatedInstanceTest { public void testConstructor() { SoRelatedInstance obj = new SoRelatedInstance(); - assertTrue(obj.getInstanceId() == null); - assertTrue(obj.getInstanceName() == null); - assertTrue(obj.getModelInfo() == null); + assertNull(obj.getInstanceId()); + assertNull(obj.getInstanceName()); + assertNull(obj.getModelInfo()); } @Test 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 25a89e31e..2fea0f868 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 @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Ericsson. All rights reserved. * ================================================================================ - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved + * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,6 +27,7 @@ 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.assertNull; import static org.junit.Assert.assertTrue; import java.util.ArrayList; @@ -39,13 +40,13 @@ public class SoRequestDetailsTest { public void testConstructor() { SoRequestDetails obj = new SoRequestDetails(); - assertTrue(obj.getCloudConfiguration() == null); - assertTrue(obj.getModelInfo() == null); - assertTrue(obj.getRequestInfo() == null); - assertTrue(obj.getRequestParameters() == null); - assertTrue(obj.getSubscriberInfo() == null); + assertNull(obj.getCloudConfiguration()); + assertNull(obj.getModelInfo()); + assertNull(obj.getRequestInfo()); + assertNull(obj.getRequestParameters()); + assertNull(obj.getSubscriberInfo()); - assertTrue(obj.getRelatedInstanceList() != null); + assertNotNull(obj.getRelatedInstanceList()); assertEquals(0, obj.getRelatedInstanceList().size()); } @@ -73,7 +74,7 @@ public class SoRequestDetailsTest { obj.setSubscriberInfo(subscriberInfo); assertEquals(subscriberInfo, obj.getSubscriberInfo()); } - + @Test public void testSoMRequestDetailsMethods() { SoRequestDetails details = new SoRequestDetails(); @@ -118,7 +119,7 @@ public class SoRequestDetailsTest { assertTrue(details.equals(copiedDetails)); assertFalse(details.equals(null)); assertFalse(details.equals("Hello")); - + details.setCloudConfiguration(null); assertFalse(details.equals(copiedDetails)); copiedDetails.setCloudConfiguration(null); @@ -136,7 +137,7 @@ public class SoRequestDetailsTest { assertFalse(details.equals(copiedDetails)); copiedDetails.setModelInfo(modelInfo); assertTrue(details.equals(copiedDetails)); - + details.setRequestInfo(null); assertFalse(details.equals(copiedDetails)); copiedDetails.setRequestInfo(null); diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java index e0b819343..f70e598f2 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * so * ================================================================================ - * 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 AT&T Intellectual Property. All rights reserved * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ @@ -23,7 +23,7 @@ package org.onap.policy.so; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNull; import org.junit.Test; @@ -33,8 +33,8 @@ public class SoRequestErrorTest { public void testConstructor() { SoRequestError obj = new SoRequestError(); - assertTrue(obj.getPolicyException() == null); - assertTrue(obj.getServiceException() == null); + assertNull(obj.getPolicyException()); + assertNull(obj.getServiceException()); } @Test diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java index 92638f906..563e28d31 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java @@ -2,8 +2,7 @@ * ============LICENSE_START======================================================= * so * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 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"); @@ -23,7 +22,8 @@ package org.onap.policy.so; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import org.junit.Test; @@ -33,8 +33,8 @@ public class SoRequestParametersTest { public void testConstructor() { SoRequestParameters obj = new SoRequestParameters(); - assertTrue(obj.getSubscriptionServiceType() == null); - assertTrue(obj.getUserParams() != null); + assertNull(obj.getSubscriptionServiceType()); + assertNotNull(obj.getUserParams()); assertEquals(0, obj.getUserParams().size()); } diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java index 42481996a..83172dee2 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java @@ -2,8 +2,7 @@ * ============LICENSE_START======================================================= * so * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 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"); @@ -23,7 +22,7 @@ package org.onap.policy.so; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNull; import org.junit.Test; @@ -33,8 +32,8 @@ public class SoRequestReferencesTest { public void testConstructor() { SoRequestReferences obj = new SoRequestReferences(); - assertTrue(obj.getInstanceId() == null); - assertTrue(obj.getRequestId() == null); + assertNull(obj.getInstanceId()); + assertNull(obj.getRequestId()); } @Test diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java index b83cb00dc..2b0c572ce 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java @@ -2,8 +2,7 @@ * ============LICENSE_START======================================================= * so * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 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"); @@ -24,6 +23,7 @@ package org.onap.policy.so; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import org.junit.Test; @@ -35,8 +35,8 @@ public class SoRequestStatusTest { SoRequestStatus obj = new SoRequestStatus(); assertEquals(0, obj.getPercentProgress()); - assertTrue(obj.getRequestState() == null); - assertTrue(obj.getTimestamp() == null); + assertNull(obj.getRequestState()); + assertNull(obj.getTimestamp()); assertFalse(obj.isWasRolledBack()); } diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java index 4dba63511..959016445 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java @@ -2,8 +2,7 @@ * ============LICENSE_START======================================================= * so * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 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"); @@ -23,7 +22,7 @@ package org.onap.policy.so; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNull; import java.time.LocalDateTime; import java.util.UUID; @@ -35,13 +34,13 @@ public class SoRequestTest { public void testConstructor() { SoRequest obj = new SoRequest(); - assertTrue(obj.getFinishTime() == null); - assertTrue(obj.getRequestDetails() == null); - assertTrue(obj.getRequestId() == null); - assertTrue(obj.getRequestScope() == null); - assertTrue(obj.getRequestStatus() == null); - assertTrue(obj.getRequestType() == null); - assertTrue(obj.getStartTime() == null); + assertNull(obj.getFinishTime()); + assertNull(obj.getRequestDetails()); + assertNull(obj.getRequestId()); + assertNull(obj.getRequestScope()); + assertNull(obj.getRequestStatus()); + assertNull(obj.getRequestType()); + assertNull(obj.getStartTime()); } @Test diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java index eb1b0ef6d..c75aa9ec9 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java @@ -2,8 +2,7 @@ * ============LICENSE_START======================================================= * so * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 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"); @@ -23,7 +22,7 @@ package org.onap.policy.so; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNull; import org.junit.Test; @@ -34,9 +33,9 @@ public class SoResponseTest { SoResponse obj = new SoResponse(); assertEquals(0, obj.getHttpResponseCode()); - assertTrue(obj.getRequest() == null); - assertTrue(obj.getRequestError() == null); - assertTrue(obj.getRequestReferences() == null); + assertNull(obj.getRequest()); + assertNull(obj.getRequestError()); + assertNull(obj.getRequestReferences()); } @Test 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 635e7dd16..e508c44f8 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * so * ================================================================================ - * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-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.so; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; @@ -73,12 +72,16 @@ public class SoResponseWrapperTest { SoResponseWrapper identicalResponseWrapper = new SoResponseWrapper(response, requestId); - assertEquals(responseWrapper, responseWrapper); + /* + * Disabling sonar because we are purposely checking various branches of the + * equals() method. + */ + assertEquals(responseWrapper, responseWrapper); // NOSONAR assertEquals(responseWrapper, identicalResponseWrapper); assertNotEquals(null, responseWrapper); - assertNotEquals("Hello", responseWrapper); - assertFalse(responseWrapper.equals(null)); - assertFalse(responseWrapper.equals("AString")); + assertNotEquals("Hello", responseWrapper); // NOSONAR + assertNotEquals(responseWrapper, null); + assertNotEquals(responseWrapper, "AString"); // NOSONAR assertEquals(new SoResponseWrapper(null, null), new SoResponseWrapper(null, null)); assertNotEquals(new SoResponseWrapper(null, null), identicalResponseWrapper); diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java index b5f31e595..981db650d 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java @@ -2,8 +2,7 @@ * ============LICENSE_START======================================================= * so * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 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"); @@ -23,7 +22,8 @@ package org.onap.policy.so; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import org.junit.Test; @@ -33,9 +33,9 @@ public class SoServiceExceptionHolderTest { public void testConstructor() { SoServiceExceptionHolder obj = new SoServiceExceptionHolder(); - assertTrue(obj.getMessageId() == null); - assertTrue(obj.getText() == null); - assertTrue(obj.getVariables() != null); + assertNull(obj.getMessageId()); + assertNull(obj.getText()); + assertNotNull(obj.getVariables()); assertEquals(0, obj.getVariables().size()); } diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java index 4d5bc7504..56278b0a9 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java @@ -2,8 +2,7 @@ * ============LICENSE_START======================================================= * so * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 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"); @@ -23,7 +22,7 @@ package org.onap.policy.so; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNull; import org.junit.Test; @@ -33,9 +32,9 @@ public class SoSubscriberInfoTest { public void testConstructor() { SoSubscriberInfo obj = new SoSubscriberInfo(); - assertTrue(obj.getGlobalSubscriberId() == null); - assertTrue(obj.getSubscriberCommonSiteId() == null); - assertTrue(obj.getSubscriberName() == null); + assertNull(obj.getGlobalSubscriberId()); + assertNull(obj.getSubscriberCommonSiteId()); + assertNull(obj.getSubscriberName()); } @Test |