diff options
author | Taka Cho <takamune.cho@att.com> | 2020-06-09 11:21:31 -0400 |
---|---|---|
committer | Taka Cho <takamune.cho@att.com> | 2020-06-15 12:16:32 -0400 |
commit | 6e22f6ba5a83c8e55bec56798e8e4c7a3d4b002b (patch) | |
tree | 6257a46d109aae731d9f1a98c334251d6cc9d513 /feature-healthcheck/src/test/java | |
parent | 7a64baa7a15c07c2bbb90c41594b82e8c8bfc816 (diff) |
reduce sonar issue - 2 rev
In some conditions for assertTrue, sonarcloud
recommends using assertEquals
Assert.assertTrue(a.equals(b));
Assert.assertTrue(a == b);
Assert.assertTrue(a == null);
Assert.assertTrue(a != null);
Assert.assertFalse(a.equals(b));
Compliant Solution
Assert.assertEquals(a, b);
Assert.assertSame(a, b);
Assert.assertNull(a);
Assert.assertNotNull(a);
Assert.assertNotEquals(a, b);
Issue-ID: POLICY-2616
Change-Id: Ib362573bd865d1b561916bf64640c8ddeaa02546
Signed-off-by: Taka Cho <takamune.cho@att.com>
Diffstat (limited to 'feature-healthcheck/src/test/java')
-rw-r--r-- | feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/HealthCheckTest.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/HealthCheckTest.java b/feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/HealthCheckTest.java index 62c6c951..4215aa8c 100644 --- a/feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/HealthCheckTest.java +++ b/feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/HealthCheckTest.java @@ -23,6 +23,7 @@ package org.onap.policy.drools.healthcheck; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -142,12 +143,12 @@ public class HealthCheckTest { reports.setDetails(lst); reports.setHealthy(true); - assertTrue(lst == reports.getDetails()); - assertEquals(true, reports.isHealthy()); + assertSame(lst, reports.getDetails()); + assertTrue(reports.isHealthy()); // flip the flag reports.setHealthy(false); - assertEquals(false, reports.isHealthy()); + assertFalse(reports.isHealthy()); // toString should work with populated data assertNotNull(reports.toString()); |