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/sdnr/src | |
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/sdnr/src')
7 files changed, 141 insertions, 135 deletions
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 dfd89c0fe..8c7ee6d53 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 @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,10 +23,8 @@ package org.onap.policy.sdnr; 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.time.Instant; import java.util.HashMap; @@ -79,70 +77,73 @@ public class PciCommonHeaderTest { copiedPciCommonHeader.setSubRequestId(commonHeader.getSubRequestId()); copiedPciCommonHeader.setTimeStamp(commonHeader.getTimeStamp()); - assertTrue(commonHeader.equals(commonHeader)); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); - assertFalse(commonHeader.equals(null)); - assertFalse(commonHeader.equals("Hello")); + /* + * Disabling sonar to test equals(). + */ + assertEquals(commonHeader, commonHeader); // NOSONAR + assertEquals(commonHeader, copiedPciCommonHeader); + assertNotEquals(commonHeader, null); + assertNotEquals(commonHeader, "Hello"); // NOSONAR PciCommonHeader clonedPciCommonHeader = new PciCommonHeader(commonHeader); clonedPciCommonHeader.setApiVer(commonHeader.getApiVer()); clonedPciCommonHeader.setTimeStamp(commonHeader.getTimeStamp()); - assertTrue(commonHeader.equals(clonedPciCommonHeader)); + assertEquals(commonHeader, clonedPciCommonHeader); commonHeader.setApiVer(null); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); + assertNotEquals(commonHeader, copiedPciCommonHeader); copiedPciCommonHeader.setApiVer(null); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); + assertEquals(commonHeader, copiedPciCommonHeader); commonHeader.setApiVer(KANSAS); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); + assertNotEquals(commonHeader, copiedPciCommonHeader); copiedPciCommonHeader.setApiVer(KANSAS); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); + assertEquals(commonHeader, copiedPciCommonHeader); commonHeader.setFlags(null); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); + assertNotEquals(commonHeader, copiedPciCommonHeader); copiedPciCommonHeader.setFlags(null); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); + assertEquals(commonHeader, copiedPciCommonHeader); commonHeader.setFlags(flagMap); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); + assertNotEquals(commonHeader, copiedPciCommonHeader); copiedPciCommonHeader.setFlags(flagMap); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); + assertEquals(commonHeader, copiedPciCommonHeader); commonHeader.setRequestTrack(null); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); + assertNotEquals(commonHeader, copiedPciCommonHeader); copiedPciCommonHeader.setRequestTrack(null); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); + assertEquals(commonHeader, copiedPciCommonHeader); commonHeader.setRequestTrack(requestMap); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); + assertNotEquals(commonHeader, copiedPciCommonHeader); copiedPciCommonHeader.setRequestTrack(requestMap); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); + assertEquals(commonHeader, copiedPciCommonHeader); commonHeader.setRequestId(null); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); + assertNotEquals(commonHeader, copiedPciCommonHeader); copiedPciCommonHeader.setRequestId(null); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); + assertEquals(commonHeader, copiedPciCommonHeader); commonHeader.setRequestId(requestId); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); + assertNotEquals(commonHeader, copiedPciCommonHeader); copiedPciCommonHeader.setRequestId(requestId); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); + assertEquals(commonHeader, copiedPciCommonHeader); commonHeader.setSubRequestId(null); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); + assertNotEquals(commonHeader, copiedPciCommonHeader); copiedPciCommonHeader.setSubRequestId(null); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); + assertEquals(commonHeader, copiedPciCommonHeader); commonHeader.setSubRequestId(CAN_I_GO_HOME); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); + assertNotEquals(commonHeader, copiedPciCommonHeader); copiedPciCommonHeader.setSubRequestId(CAN_I_GO_HOME); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); + assertEquals(commonHeader, copiedPciCommonHeader); commonHeader.setTimeStamp(null); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); + assertNotEquals(commonHeader, copiedPciCommonHeader); copiedPciCommonHeader.setTimeStamp(null); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); + assertEquals(commonHeader, copiedPciCommonHeader); commonHeader.setTimeStamp(timestamp); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); + assertNotEquals(commonHeader, copiedPciCommonHeader); copiedPciCommonHeader.setTimeStamp(timestamp); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); + assertEquals(commonHeader, copiedPciCommonHeader); } } 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 0009c2a5c..7719d0966 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 @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,10 +23,8 @@ package org.onap.policy.sdnr; 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; @@ -61,36 +59,39 @@ public class PciRequestTest { copiedPciRequest.setAction(request.getAction()); copiedPciRequest.setPayload(request.getPayload()); - assertTrue(request.equals(request)); - assertTrue(request.equals(copiedPciRequest)); - assertFalse(request.equals(null)); - assertFalse(request.equals("Hello")); + /* + * Disabling sonar to test equals(). + */ + assertEquals(request, request); // NOSONAR + assertEquals(request, copiedPciRequest); + assertNotEquals(request, null); + assertNotEquals(request, "Hello"); // NOSONAR request.setCommonHeader(null); - assertFalse(request.equals(copiedPciRequest)); + assertNotEquals(request, copiedPciRequest); copiedPciRequest.setCommonHeader(null); - assertTrue(request.equals(copiedPciRequest)); + assertEquals(request, copiedPciRequest); request.setCommonHeader(commonHeader); - assertFalse(request.equals(copiedPciRequest)); + assertNotEquals(request, copiedPciRequest); copiedPciRequest.setCommonHeader(commonHeader); - assertTrue(request.equals(copiedPciRequest)); + assertEquals(request, copiedPciRequest); request.setAction(null); - assertFalse(request.equals(copiedPciRequest)); + assertNotEquals(request, copiedPciRequest); copiedPciRequest.setAction(null); - assertTrue(request.equals(copiedPciRequest)); + assertEquals(request, copiedPciRequest); request.setAction(MODIFY); - assertFalse(request.equals(copiedPciRequest)); + assertNotEquals(request, copiedPciRequest); copiedPciRequest.setAction(MODIFY); - assertTrue(request.equals(copiedPciRequest)); + assertEquals(request, copiedPciRequest); request.setPayload(null); - assertFalse(request.equals(copiedPciRequest)); + assertNotEquals(request, copiedPciRequest); copiedPciRequest.setPayload(null); - assertTrue(request.equals(copiedPciRequest)); + assertEquals(request, copiedPciRequest); request.setPayload(requestPayload); - assertFalse(request.equals(copiedPciRequest)); + assertNotEquals(request, copiedPciRequest); copiedPciRequest.setPayload(requestPayload); - assertTrue(request.equals(copiedPciRequest)); + assertEquals(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 897c57d8c..65f362378 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 @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,10 +23,8 @@ package org.onap.policy.sdnr; 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; @@ -50,18 +49,21 @@ public class PciRequestWrapperTest { PciRequestWrapper copiedPciRequestWrapper = new PciRequestWrapper(); copiedPciRequestWrapper.setBody(requestWrapper.getBody()); - assertTrue(requestWrapper.equals(requestWrapper)); - assertTrue(requestWrapper.equals(copiedPciRequestWrapper)); - assertFalse(requestWrapper.equals(null)); - assertFalse(requestWrapper.equals("Hello")); + /* + * Disabling sonar to test equals(). + */ + assertEquals(requestWrapper, requestWrapper); // NOSONAR + assertEquals(requestWrapper, copiedPciRequestWrapper); + assertNotEquals(requestWrapper, null); + assertNotEquals(requestWrapper, "Hello"); // NOSONAR requestWrapper.setBody(null); - assertFalse(requestWrapper.equals(copiedPciRequestWrapper)); + assertNotEquals(requestWrapper, copiedPciRequestWrapper); copiedPciRequestWrapper.setBody(null); - assertTrue(requestWrapper.equals(copiedPciRequestWrapper)); + assertEquals(requestWrapper, copiedPciRequestWrapper); requestWrapper.setBody(request); - assertFalse(requestWrapper.equals(copiedPciRequestWrapper)); + assertNotEquals(requestWrapper, copiedPciRequestWrapper); copiedPciRequestWrapper.setBody(request); - assertTrue(requestWrapper.equals(copiedPciRequestWrapper)); + assertEquals(requestWrapper, copiedPciRequestWrapper); } } diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java index 6e990ea12..bd96e8e4c 100644 --- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java +++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,10 +22,11 @@ package org.onap.policy.sdnr; +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 org.junit.Test; @@ -40,13 +41,13 @@ public class PciResponseTest { @Test public void testHashCode() { PciResponse response = new PciResponse(); - assertTrue(response.hashCode() != 0); + assertNotEquals(0, response.hashCode()); response.setCommonHeader(new PciCommonHeader()); - assertTrue(response.hashCode() != 0); + assertNotEquals(0, response.hashCode()); response.setPayload(responsePayload); - assertTrue(response.hashCode() != 0); + assertNotEquals(0, response.hashCode()); response.setStatus(null); - assertTrue(response.hashCode() != 0); + assertNotEquals(0, response.hashCode()); } @Test @@ -66,43 +67,43 @@ public class PciResponseTest { @Test public void testEqualsObject() { PciResponse response = new PciResponse(); - assertTrue(response.equals(response)); - assertFalse(response.equals(null)); - assertFalse(response.equals(new Object())); + assertEquals(response, response); + assertNotEquals(response, null); + assertNotEquals(response, new Object()); PciResponse response2 = new PciResponse(); - assertTrue(response.equals(response2)); + assertEquals(response, response2); response.setCommonHeader(new PciCommonHeader()); - assertFalse(response.equals(response2)); + assertNotEquals(response, response2); response2.setCommonHeader(response.getCommonHeader()); - assertTrue(response.equals(response2)); + assertEquals(response, response2); response.setPayload(responsePayload); - assertFalse(response.equals(response2)); + assertNotEquals(response, response2); response2.setPayload(response.getPayload()); - assertTrue(response.equals(response2)); + assertEquals(response, response2); response.setCommonHeader(null); - assertFalse(response.equals(response2)); + assertNotEquals(response, response2); response2.setCommonHeader(null); - assertTrue(response.equals(response2)); + assertEquals(response, response2); response.setPayload(null); - assertFalse(response.equals(response2)); + assertNotEquals(response, response2); response2.setPayload(response.getPayload()); - assertTrue(response.equals(response2)); + assertEquals(response, response2); response.setStatus(null); - assertFalse(response.equals(response2)); + assertNotEquals(response, response2); response2.setStatus(response.getStatus()); - assertTrue(response.equals(response2)); + assertEquals(response, response2); Status stat = new Status(); stat.setCode(5); response.setStatus(stat); response2.setStatus(new Status()); - assertFalse(response.equals(response2)); + assertNotEquals(response, response2); } @Test @@ -113,7 +114,7 @@ public class PciResponseTest { PciResponse response = new PciResponse(request); - assertTrue(response.getCommonHeader().equals(request.getCommonHeader())); + assertEquals(response.getCommonHeader(), request.getCommonHeader()); } } 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 166c3aa61..cb12083f3 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 @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,10 +23,8 @@ package org.onap.policy.sdnr; 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; @@ -50,18 +49,21 @@ public class PciResponseWrapperTest { PciResponseWrapper copiedPciResponseWrapper = new PciResponseWrapper(); copiedPciResponseWrapper.setBody(responseWrapper.getBody()); - assertTrue(responseWrapper.equals(responseWrapper)); - //assertTrue(responseWrapper.equals(copiedPciResponseWrapper)); - assertFalse(responseWrapper.equals(null)); - assertFalse(responseWrapper.equals("Hello")); + /* + * Disabling sonar to test equals(). + */ + assertEquals(responseWrapper, responseWrapper); // NOSONAR + //assertEquals(responseWrapper, copiedPciResponseWrapper); + assertNotEquals(responseWrapper, null); + assertNotEquals(responseWrapper, "Hello"); // NOSONAR responseWrapper.setBody(null); - assertFalse(responseWrapper.equals(copiedPciResponseWrapper)); + assertNotEquals(responseWrapper, copiedPciResponseWrapper); copiedPciResponseWrapper.setBody(null); - //assertTrue(responseWrapper.equals(copiedPciResponseWrapper)); + //assertEquals(responseWrapper, copiedPciResponseWrapper); responseWrapper.setBody(response); - //assertFalse(responseWrapper.equals(copiedPciResponseWrapper)); + //assertNotEquals(responseWrapper, copiedPciResponseWrapper); copiedPciResponseWrapper.setBody(response); - //assertTrue(responseWrapper.equals(copiedPciResponseWrapper)); + //assertEquals(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 08ac56b85..2f6c7f8ba 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 @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,10 +23,8 @@ package org.onap.policy.sdnr; 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; @@ -52,27 +50,30 @@ public class PciStatusTest { copiedStatus.setCode(status.getCode()); copiedStatus.setValue(status.getValue()); - assertTrue(status.equals(status)); - assertTrue(status.equals(copiedStatus)); - assertFalse(status.equals(null)); - assertFalse(status.equals("Hello")); + /* + * Disabling sonar to test equals(). + */ + assertEquals(status, status); // NOSONAR + assertEquals(status, copiedStatus); + assertNotEquals(status, null); + assertNotEquals(status, "Hello"); // NOSONAR status.setCode(-1); - assertFalse(status.equals(copiedStatus)); + assertNotEquals(status, copiedStatus); copiedStatus.setCode(-1); - assertTrue(status.equals(copiedStatus)); + assertEquals(status, copiedStatus); status.setCode(1234); - assertFalse(status.equals(copiedStatus)); + assertNotEquals(status, copiedStatus); copiedStatus.setCode(1234); - assertTrue(status.equals(copiedStatus)); + assertEquals(status, copiedStatus); status.setValue(null); - assertFalse(status.equals(copiedStatus)); + assertNotEquals(status, copiedStatus); copiedStatus.setValue(null); - assertTrue(status.equals(copiedStatus)); + assertEquals(status, copiedStatus); status.setValue(THE_WONDERFUL_LAND_OF_OZ); - assertFalse(status.equals(copiedStatus)); + assertNotEquals(status, copiedStatus); copiedStatus.setValue(THE_WONDERFUL_LAND_OF_OZ); - assertTrue(status.equals(copiedStatus)); + assertEquals(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 f05f50e67..d25be8340 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 @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,10 +23,8 @@ package org.onap.policy.sdnr; 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; @@ -70,54 +68,54 @@ public class PciWrapperTest { copiedPciWrapper.setCorrelationId(wrapper.getCorrelationId()); copiedPciWrapper.setType(wrapper.getType()); - assertTrue(wrapper.equals(wrapper)); - assertTrue(wrapper.equals(copiedPciWrapper)); - assertFalse(wrapper.equals(null)); - assertFalse(wrapper.equals("Hello")); + assertEquals(wrapper, wrapper); + assertEquals(wrapper, copiedPciWrapper); + assertNotEquals(wrapper, null); + assertNotEquals(wrapper, "Hello"); wrapper.setVersion(null); - assertFalse(wrapper.equals(copiedPciWrapper)); + assertNotEquals(wrapper, copiedPciWrapper); copiedPciWrapper.setVersion(null); - assertTrue(wrapper.equals(copiedPciWrapper)); + assertEquals(wrapper, copiedPciWrapper); wrapper.setVersion(VERSION_19); - assertFalse(wrapper.equals(copiedPciWrapper)); + assertNotEquals(wrapper, copiedPciWrapper); copiedPciWrapper.setVersion(VERSION_19); - assertTrue(wrapper.equals(copiedPciWrapper)); + assertEquals(wrapper, copiedPciWrapper); wrapper.setCambriaPartition(null); - assertFalse(wrapper.equals(copiedPciWrapper)); + assertNotEquals(wrapper, copiedPciWrapper); copiedPciWrapper.setCambriaPartition(null); - assertTrue(wrapper.equals(copiedPciWrapper)); + assertEquals(wrapper, copiedPciWrapper); wrapper.setCambriaPartition(THE_EMERALD_CITY); - assertFalse(wrapper.equals(copiedPciWrapper)); + assertNotEquals(wrapper, copiedPciWrapper); copiedPciWrapper.setCambriaPartition(THE_EMERALD_CITY); - assertTrue(wrapper.equals(copiedPciWrapper)); + assertEquals(wrapper, copiedPciWrapper); wrapper.setRpcName(null); - assertFalse(wrapper.equals(copiedPciWrapper)); + assertNotEquals(wrapper, copiedPciWrapper); copiedPciWrapper.setRpcName(null); - assertTrue(wrapper.equals(copiedPciWrapper)); + assertEquals(wrapper, copiedPciWrapper); wrapper.setRpcName(TORNADO); - assertFalse(wrapper.equals(copiedPciWrapper)); + assertNotEquals(wrapper, copiedPciWrapper); copiedPciWrapper.setRpcName(TORNADO); - assertTrue(wrapper.equals(copiedPciWrapper)); + assertEquals(wrapper, copiedPciWrapper); wrapper.setCorrelationId(null); - assertFalse(wrapper.equals(copiedPciWrapper)); + assertNotEquals(wrapper, copiedPciWrapper); copiedPciWrapper.setCorrelationId(null); - assertTrue(wrapper.equals(copiedPciWrapper)); + assertEquals(wrapper, copiedPciWrapper); wrapper.setCorrelationId(YELLOW_BRICK_ROAD); - assertFalse(wrapper.equals(copiedPciWrapper)); + assertNotEquals(wrapper, copiedPciWrapper); copiedPciWrapper.setCorrelationId(YELLOW_BRICK_ROAD); - assertTrue(wrapper.equals(copiedPciWrapper)); + assertEquals(wrapper, copiedPciWrapper); wrapper.setType(null); - assertFalse(wrapper.equals(copiedPciWrapper)); + assertNotEquals(wrapper, copiedPciWrapper); copiedPciWrapper.setType(null); - assertTrue(wrapper.equals(copiedPciWrapper)); + assertEquals(wrapper, copiedPciWrapper); wrapper.setType(MUNCHKIN); - assertFalse(wrapper.equals(copiedPciWrapper)); + assertNotEquals(wrapper, copiedPciWrapper); copiedPciWrapper.setType(MUNCHKIN); - assertTrue(wrapper.equals(copiedPciWrapper)); + assertEquals(wrapper, copiedPciWrapper); } } |