FINERACT-822 Enabling AssertEqualsArgumentOrderChecker check (#982)

This commit is contained in:
Percy Ayuk Ashu
2020-06-05 09:10:18 +01:00
committed by GitHub
parent 960e81af1c
commit 99b0136f40
12 changed files with 28 additions and 28 deletions
+1 -1
View File
@@ -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",
@@ -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());
}
}
@@ -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());
}
}
}
@@ -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);
}
@@ -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
@@ -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);
@@ -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);
}
}
}
@@ -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"));
}
}
@@ -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 {
}
}
}
@@ -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);
}
}
}
@@ -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);
}
}
@@ -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() {