From 6e22f6ba5a83c8e55bec56798e8e4c7a3d4b002b Mon Sep 17 00:00:00 2001 From: Taka Cho Date: Tue, 9 Jun 2020 11:21:31 -0400 Subject: 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 --- .../test/java/org/onap/policy/drools/eelf/test/EElfTest.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'feature-eelf/src/test/java/org/onap') diff --git a/feature-eelf/src/test/java/org/onap/policy/drools/eelf/test/EElfTest.java b/feature-eelf/src/test/java/org/onap/policy/drools/eelf/test/EElfTest.java index c0f271cf..dfa85948 100644 --- a/feature-eelf/src/test/java/org/onap/policy/drools/eelf/test/EElfTest.java +++ b/feature-eelf/src/test/java/org/onap/policy/drools/eelf/test/EElfTest.java @@ -20,6 +20,7 @@ package org.onap.policy.drools.eelf.test; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -76,11 +77,11 @@ public class EElfTest { * @param slf4jLogger SLF4J Logger */ protected void assertLogLevels(EELFLogger eelfLogger, Logger slf4jLogger) { - assertTrue(slf4jLogger.isDebugEnabled() == eelfLogger.isDebugEnabled()); - assertTrue(slf4jLogger.isInfoEnabled() == eelfLogger.isInfoEnabled()); - assertTrue(slf4jLogger.isErrorEnabled() == eelfLogger.isErrorEnabled()); - assertTrue(slf4jLogger.isWarnEnabled() == eelfLogger.isWarnEnabled()); - assertTrue(slf4jLogger.isTraceEnabled() == eelfLogger.isTraceEnabled()); + assertEquals(slf4jLogger.isDebugEnabled(), eelfLogger.isDebugEnabled()); + assertEquals(slf4jLogger.isInfoEnabled(), eelfLogger.isInfoEnabled()); + assertEquals(slf4jLogger.isErrorEnabled(), eelfLogger.isErrorEnabled()); + assertEquals(slf4jLogger.isWarnEnabled(), eelfLogger.isWarnEnabled()); + assertEquals(slf4jLogger.isTraceEnabled(), eelfLogger.isTraceEnabled()); } @Test -- cgit 1.2.3-korg