You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by aw...@apache.org on 2020/06/05 08:10:27 UTC

[fineract] branch develop updated: FINERACT-822 Enabling AssertEqualsArgumentOrderChecker check (#982)

This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git


The following commit(s) were added to refs/heads/develop by this push:
     new 99b0136  FINERACT-822 Enabling AssertEqualsArgumentOrderChecker check (#982)
99b0136 is described below

commit 99b0136f40928a8d061533aaedb74edcfb1300e4
Author: Percy Ayuk Ashu <pe...@gmail.com>
AuthorDate: Fri Jun 5 09:10:18 2020 +0100

    FINERACT-822 Enabling AssertEqualsArgumentOrderChecker check (#982)
---
 fineract-provider/build.gradle                               |  2 +-
 .../integrationtests/AccountNumberPreferencesTest.java       |  2 +-
 .../org/apache/fineract/integrationtests/BatchApiTest.java   |  4 ++--
 .../fineract/integrationtests/ClientStatusChecker.java       | 12 ++++++------
 .../fineract/integrationtests/FundsIntegrationTest.java      |  2 +-
 .../LoanDisbursementDetailsIntegrationTest.java              |  4 ++--
 .../java/org/apache/fineract/integrationtests/RolesTest.java |  8 ++++----
 .../java/org/apache/fineract/integrationtests/StaffTest.java |  8 ++++----
 .../org/apache/fineract/integrationtests/SystemCodeTest.java |  6 +++---
 .../apache/fineract/integrationtests/common/BatchHelper.java |  4 ++--
 .../fineract/integrationtests/common/ClientChargesTest.java  |  2 +-
 .../java/org/apache/fineract/notification/StorageTest.java   |  2 +-
 12 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/fineract-provider/build.gradle b/fineract-provider/build.gradle
index d7e256e..2d7a256 100644
--- a/fineract-provider/build.gradle
+++ b/fineract-provider/build.gradle
@@ -318,7 +318,6 @@ tasks.withType(JavaCompile) {
                 "BigDecimalEquals",
                 "ImmutableEnumChecker",
                 "EqualsUnsafeCast",
-                "AssertEqualsArgumentOrderChecker",
                 "BoxedPrimitiveEquality",
                 "BadImport",
                 "UnusedMethod",
@@ -339,6 +338,7 @@ tasks.withType(JavaCompile) {
                 "ThreeLetterTimeZoneID",
                 "VariableNameSameAsType",
                 "UnnecessaryParentheses",
+                "AssertEqualsArgumentOrderChecker",
 //                "ReturnMissingNullable",
 //                "InconsistentOverloads",
 //                "MethodCanBeStatic",
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountNumberPreferencesTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountNumberPreferencesTest.java
index 4e28a56..d236bde 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountNumberPreferencesTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountNumberPreferencesTest.java
@@ -376,7 +376,7 @@ public class AccountNumberPreferencesTest {
             Assert.assertEquals(accountNumber.length(), prefix.length() + 9);
             Assert.assertTrue(accountNumber.startsWith(prefix));
         } else {
-            Assert.assertEquals(accountNumber.length(), 9);
+            Assert.assertEquals(9, accountNumber.length());
         }
     }
 
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/BatchApiTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/BatchApiTest.java
index 1dd3d9c..28d0a8c 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/BatchApiTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/BatchApiTest.java
@@ -155,7 +155,7 @@ public class BatchApiTest {
         BatchHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, "TestExtId12");
 
         // Asserts that all the transactions have been successfully rolled back
-        Assert.assertEquals(response.size(), 1);
+        Assert.assertEquals(1, response.size());
         Assert.assertEquals("Verify Status code 400", (long) 400, (long) response.get(0).getStatusCode());
     }
 
@@ -532,4 +532,4 @@ public class BatchApiTest {
         Assert.assertEquals("Verify Status Code 200 for approve Loan", 200L, (long) response.get(2).getStatusCode());
         Assert.assertEquals("Verify Status Code 200 for disburse Loan", 200L, (long) response.get(3).getStatusCode());
     }
-}
\ No newline at end of file
+}
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientStatusChecker.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientStatusChecker.java
index f7892ba..3e684f7 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientStatusChecker.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientStatusChecker.java
@@ -28,41 +28,41 @@ public class ClientStatusChecker {
     private final static Logger LOG = LoggerFactory.getLogger(ClientStatusChecker.class);
 
     public static void verifyClientIsActive(final HashMap<String, Object> clientStatusHashMap) {
-        assertEquals((int) clientStatusHashMap.get("id"), 300);
+        assertEquals(300, (int) clientStatusHashMap.get("id"));
     }
 
     public static void verifyClientClosed(final HashMap<String, Object> clientStatusHashMap) {
         LOG.info(
                 "\n-------------------------------------- VERIFYING CLIENT IS CLOSED ------------------------------------");
-        assertEquals((int) clientStatusHashMap.get("id"), 600);
+        assertEquals(600, (int) clientStatusHashMap.get("id"));
         LOG.info("Client Status: {} \n", clientStatusHashMap);
     }
 
     public static void verifyClientPending(final HashMap<String, Object> clientStatusHashMap) {
         LOG.info(
                 "\n-------------------------------------- VERIFYING CLIENT IS PENDING ------------------------------------");
-        assertEquals((int) clientStatusHashMap.get("id"), 100);
+        assertEquals(100, (int) clientStatusHashMap.get("id"));
         LOG.info("Client Status: {} \n", clientStatusHashMap);
     }
 
     public static void verifyClientRejected(final HashMap<String, Object> clientStatusHashMap) {
         LOG.info(
                 "\n-------------------------------------- VERIFYING CLIENT IS REJECTED ------------------------------------");
-        assertEquals((int) clientStatusHashMap.get("id"), 700);
+        assertEquals(700, (int) clientStatusHashMap.get("id"));
         LOG.info("Client Status: {} \n", clientStatusHashMap);
     }
 
     public static void verifyClientActiavted(final HashMap<String, Object> clientStatusHashMap) {
         LOG.info(
                 "\n-------------------------------------- VERIFYING CLIENT IS ACTIVATED ------------------------------------");
-        assertEquals((int) clientStatusHashMap.get("id"), 300);
+        assertEquals(300, (int) clientStatusHashMap.get("id"));
         LOG.info("Client Status: {} \n", clientStatusHashMap);
     }
 
     public static void verifyClientWithdrawn(final HashMap<String, Object> clientStatusHashMap) {
         LOG.info(
                 "\n-------------------------------------- VERIFYING CLIENT IS WITHDRAWN ------------------------------------");
-        assertEquals((int) clientStatusHashMap.get("id"), 800);
+        assertEquals(800, (int) clientStatusHashMap.get("id"));
         LOG.info("Client Status: {} \n", clientStatusHashMap);
     }
 
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FundsIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FundsIntegrationTest.java
index 7281b2d..81800d4 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FundsIntegrationTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FundsIntegrationTest.java
@@ -202,7 +202,7 @@ public class FundsIntegrationTest {
         ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
         String jsonData = FundsResourceHandler.retrieveFund(Long.MAX_VALUE, this.requestSpec, responseSpec);
         HashMap<String, Object> map = new Gson().fromJson(jsonData, new TypeToken<HashMap<String, Object>>(){}.getType());
-        assertEquals(map.get("userMessageGlobalisationCode"), "error.msg.resource.not.found");
+        assertEquals("error.msg.resource.not.found", map.get("userMessageGlobalisationCode"));
     }
 
     @Test
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanDisbursementDetailsIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanDisbursementDetailsIntegrationTest.java
index 8da7b08..d125806 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanDisbursementDetailsIntegrationTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanDisbursementDetailsIntegrationTest.java
@@ -94,7 +94,7 @@ public class LoanDisbursementDetailsIntegrationTest {
                 loanIDWithEmi, "repaymentSchedule");
 
         ArrayList<HashMap> periods = (ArrayList<HashMap>) repaymentScheduleWithEmi.get("periods");
-        assertEquals(periods.size(), 15);
+        assertEquals(15, periods.size());
 
         this.validateRepaymentScheduleWithEMI(periods);
 
@@ -115,7 +115,7 @@ public class LoanDisbursementDetailsIntegrationTest {
                 loanIDWithoutEmi, "repaymentSchedule");
 
         ArrayList<HashMap> periods1 = (ArrayList<HashMap>) repaymentScheduleWithEmi.get("periods");
-        assertEquals(periods1.size(), 15);
+        assertEquals(15, periods1.size());
 
         LOG.info("-----------------------------------LOAN CREATED WITHOUT EMI LOANID------------------------------------------------- {}"
                         , loanIDWithoutEmi);
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RolesTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RolesTest.java
index 46697fb..5f13c25 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RolesTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RolesTest.java
@@ -81,7 +81,7 @@ public class RolesTest {
         assertEquals(disableRoleId, roleId);
         role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
         assertEquals((Integer) role.get("id"), roleId);
-        assertEquals((Boolean) role.get("disabled"), true);
+        assertEquals(true, (Boolean) role.get("disabled"));
 
     }
 
@@ -102,14 +102,14 @@ public class RolesTest {
         assertEquals(disableRoleId, roleId);
         role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
         assertEquals((Integer) role.get("id"), roleId);
-        assertEquals((Boolean) role.get("disabled"), true);
+        assertEquals(true, (Boolean) role.get("disabled"));
 
         LOG.info("--------------------------------- ENABLING ROLE -------------------------------");
         final Integer enableRoleId = RolesHelper.enableRole(this.requestSpec, this.responseSpec, roleId);
         assertEquals(enableRoleId, roleId);
         role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
         assertEquals((Integer) role.get("id"), roleId);
-        assertEquals((Boolean) role.get("disabled"), false);
+        assertEquals(false,(Boolean) role.get("disabled"));
 
     }
 
@@ -164,4 +164,4 @@ public class RolesTest {
         assertNotEquals(deletedRoleId, roleId);
     }
 
-}
\ No newline at end of file
+}
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/StaffTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/StaffTest.java
index d95949f..8b895cb 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/StaffTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/StaffTest.java
@@ -55,7 +55,7 @@ public class StaffTest {
         Map<String, Object> response = StaffHelper.createStaffMap(requestSpec, responseSpec);
 
         Assert.assertNotNull(response);
-        Assert.assertEquals(response.get("officeId"), 1);
+        Assert.assertEquals(1, response.get("officeId"));
         Assert.assertNotNull(response.get("resourceId"));
     }
 
@@ -120,7 +120,7 @@ public class StaffTest {
         Map<String, Object> response = StaffHelper.getStaff(requestSpec, responseSpec, 1);
         Assert.assertNotNull(response);
         Assert.assertNotNull(response.get("id"));
-        Assert.assertEquals(response.get("id"), 1);
+        Assert.assertEquals(1, response.get("id"));
     }
 
     @Test
@@ -138,7 +138,7 @@ public class StaffTest {
         List<Map<String, Object>> responseActive = StaffHelper.getStaffListWithState(requestSpec, responseSpec, "active");
         for(final Map<String, Object> staff : responseActive) {
             Assert.assertNotNull(staff.get("id"));
-            Assert.assertEquals(staff.get("isActive"), true);
+            Assert.assertEquals(true, staff.get("isActive"));
         }
     }
 
@@ -147,7 +147,7 @@ public class StaffTest {
         List<Map<String, Object>> responseInactive = StaffHelper.getStaffListWithState(requestSpec, responseSpec, "inactive");
         for(final Map<String, Object> staff : responseInactive) {
             Assert.assertNotNull(staff.get("id"));
-            Assert.assertEquals(staff.get("isActive"), false);
+            Assert.assertEquals(false, staff.get("isActive"));
         }
     }
 
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SystemCodeTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SystemCodeTest.java
index 01a4909..078fddd 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SystemCodeTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SystemCodeTest.java
@@ -237,9 +237,9 @@ public class SystemCodeTest {
         final HashMap codeValueChanges = (HashMap) CodeHelper.updateCodeValue(this.requestSpec, this.responseSpec, createCodeResponseId,
                 createCodeValueResponseId1, codeValue1 + "CHANGE", codeDescription1 + "CHANGE", 4, "changes");
 
-        assertEquals("Verify changed code value name", codeValueChanges.get("name"), codeValue1 + "CHANGE");
+        assertEquals("Verify changed code value name", codeValue1 + "CHANGE", codeValueChanges.get("name"));
 
-        assertEquals("Verify changed code value description", codeValueChanges.get("description"), codeDescription1 + "CHANGE");
+        assertEquals("Verify changed code value description", codeDescription1 + "CHANGE", codeValueChanges.get("description"));
 
         // delete code value
         Integer deletedCodeValueResponseId1 = (Integer) CodeHelper.deleteCodeValueById(this.requestSpec, this.generalResponseSpec,
@@ -278,4 +278,4 @@ public class SystemCodeTest {
 
     }
 
-}
\ No newline at end of file
+}
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/BatchHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/BatchHelper.java
index 3e9cf17..72e35d5 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/BatchHelper.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/BatchHelper.java
@@ -427,6 +427,6 @@ public class BatchHelper {
         LOG.info("------------------------------CHECK CLIENT DETAILS------------------------------------\n");
         final String CLIENT_URL = "/fineract-provider/api/v1/clients?externalId=" + externalId + "&" + Utils.TENANT_IDENTIFIER;
         final Integer responseRecords = Utils.performServerGet(requestSpec, responseSpec, CLIENT_URL, "totalFilteredRecords");
-        Assert.assertEquals("No records found with given externalId", (long) responseRecords, (long) 0);
+        Assert.assertEquals("No records found with given externalId", (long) 0, (long) responseRecords);
     }
-}
\ No newline at end of file
+}
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ClientChargesTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ClientChargesTest.java
index 37a06b0..e75d77d 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ClientChargesTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ClientChargesTest.java
@@ -175,7 +175,7 @@ public class ClientChargesTest {
      * @param expectedAmount
      */
     private void isValidOutstandingAmount(Object outStandingAmount, Object expectedAmount) {
-        Assert.assertEquals((float) outStandingAmount, expectedAmount);
+        Assert.assertEquals(expectedAmount, (float) outStandingAmount);
     }
 
 }
diff --git a/fineract-provider/src/test/java/org/apache/fineract/notification/StorageTest.java b/fineract-provider/src/test/java/org/apache/fineract/notification/StorageTest.java
index 70f511e..efe585f 100644
--- a/fineract-provider/src/test/java/org/apache/fineract/notification/StorageTest.java
+++ b/fineract-provider/src/test/java/org/apache/fineract/notification/StorageTest.java
@@ -126,7 +126,7 @@ public class StorageTest {
         verify(this.notificationGeneratorWritePlatformService, times(1)).create(refEq(notification, "createdAt"));
         verify(this.notificationMapperWritePlatformService, times(1)).create(refEq(notificationMapper, "createdAt"));
         verify(this.notificationGeneratorReadRepositoryWrapper, times(1)).findById(1L);
-        assertEquals(actualGeneratedNotificationId, Long.valueOf(1));
+        assertEquals(Long.valueOf(1),actualGeneratedNotificationId);
     }
 
     private String getCurrentDateTime() {