Shift String literal to left-hand side of equals 44/85844/1
authorSindhuri.A <arcot.sindhuri@huawei.com>
Fri, 19 Apr 2019 18:24:57 +0000 (23:54 +0530)
committerSindhuri.A <arcot.sindhuri@huawei.com>
Fri, 19 Apr 2019 18:24:57 +0000 (23:54 +0530)
Shift String literal to left-hand side of equals DSLNodeKey class

Issue-ID: SO-1490

Change-Id: If9c15394876e8e662fc10501c90382861dfbced9
Signed-off-by: Sindhuri.A <arcot.sindhuri@huawei.com>
common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java

index e63e226..6e2bc97 100644 (file)
@@ -73,9 +73,9 @@ public class EqualsAndHashCodeTester implements Tester {
                 boolean hasEquals = false;
                 boolean hasHashcode = false;
                 for (Method method : methods) {
-                    if (method.getName().equals("equals")) {
+                    if ("equals".equals(method.getName())) {
                         hasEquals = true;
-                    } else if (method.getName().equals("hashCode")) {
+                    } else if ("hashCode".equals(method.getName())) {
                         hasHashcode = true;
                     }
                 }
@@ -114,7 +114,7 @@ public class EqualsAndHashCodeTester implements Tester {
             Affirm.affirmTrue("HashCode test failed for [" + classInstanceOne.getClass().getName() + "]",
                     classInstanceOne.hashCode() == classInstanceTwo.hashCode());
 
-            Affirm.affirmFalse("Expected false for comparison of two unlike objects", classInstanceOne.equals("test"));
+            Affirm.affirmFalse("Expected false for comparison of two unlike objects", "test".equals(classInstanceOne));
         }
     }