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", "BigDecimalEquals",
"ImmutableEnumChecker", "ImmutableEnumChecker",
"EqualsUnsafeCast", "EqualsUnsafeCast",
"AssertEqualsArgumentOrderChecker",
"BoxedPrimitiveEquality", "BoxedPrimitiveEquality",
"BadImport", "BadImport",
"UnusedMethod", "UnusedMethod",
@@ -339,6 +338,7 @@ tasks.withType(JavaCompile) {
"ThreeLetterTimeZoneID", "ThreeLetterTimeZoneID",
"VariableNameSameAsType", "VariableNameSameAsType",
"UnnecessaryParentheses", "UnnecessaryParentheses",
"AssertEqualsArgumentOrderChecker",
// "ReturnMissingNullable", // "ReturnMissingNullable",
// "InconsistentOverloads", // "InconsistentOverloads",
// "MethodCanBeStatic", // "MethodCanBeStatic",
@@ -376,7 +376,7 @@ public class AccountNumberPreferencesTest {
Assert.assertEquals(accountNumber.length(), prefix.length() + 9); Assert.assertEquals(accountNumber.length(), prefix.length() + 9);
Assert.assertTrue(accountNumber.startsWith(prefix)); Assert.assertTrue(accountNumber.startsWith(prefix));
} else { } 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"); BatchHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, "TestExtId12");
// Asserts that all the transactions have been successfully rolled back // 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()); Assert.assertEquals("Verify Status code 400", (long) 400, (long) response.get(0).getStatusCode());
} }
@@ -28,41 +28,41 @@ public class ClientStatusChecker {
private final static Logger LOG = LoggerFactory.getLogger(ClientStatusChecker.class); private final static Logger LOG = LoggerFactory.getLogger(ClientStatusChecker.class);
public static void verifyClientIsActive(final HashMap<String, Object> clientStatusHashMap) { 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) { public static void verifyClientClosed(final HashMap<String, Object> clientStatusHashMap) {
LOG.info( LOG.info(
"\n-------------------------------------- VERIFYING CLIENT IS CLOSED ------------------------------------"); "\n-------------------------------------- VERIFYING CLIENT IS CLOSED ------------------------------------");
assertEquals((int) clientStatusHashMap.get("id"), 600); assertEquals(600, (int) clientStatusHashMap.get("id"));
LOG.info("Client Status: {} \n", clientStatusHashMap); LOG.info("Client Status: {} \n", clientStatusHashMap);
} }
public static void verifyClientPending(final HashMap<String, Object> clientStatusHashMap) { public static void verifyClientPending(final HashMap<String, Object> clientStatusHashMap) {
LOG.info( LOG.info(
"\n-------------------------------------- VERIFYING CLIENT IS PENDING ------------------------------------"); "\n-------------------------------------- VERIFYING CLIENT IS PENDING ------------------------------------");
assertEquals((int) clientStatusHashMap.get("id"), 100); assertEquals(100, (int) clientStatusHashMap.get("id"));
LOG.info("Client Status: {} \n", clientStatusHashMap); LOG.info("Client Status: {} \n", clientStatusHashMap);
} }
public static void verifyClientRejected(final HashMap<String, Object> clientStatusHashMap) { public static void verifyClientRejected(final HashMap<String, Object> clientStatusHashMap) {
LOG.info( LOG.info(
"\n-------------------------------------- VERIFYING CLIENT IS REJECTED ------------------------------------"); "\n-------------------------------------- VERIFYING CLIENT IS REJECTED ------------------------------------");
assertEquals((int) clientStatusHashMap.get("id"), 700); assertEquals(700, (int) clientStatusHashMap.get("id"));
LOG.info("Client Status: {} \n", clientStatusHashMap); LOG.info("Client Status: {} \n", clientStatusHashMap);
} }
public static void verifyClientActiavted(final HashMap<String, Object> clientStatusHashMap) { public static void verifyClientActiavted(final HashMap<String, Object> clientStatusHashMap) {
LOG.info( LOG.info(
"\n-------------------------------------- VERIFYING CLIENT IS ACTIVATED ------------------------------------"); "\n-------------------------------------- VERIFYING CLIENT IS ACTIVATED ------------------------------------");
assertEquals((int) clientStatusHashMap.get("id"), 300); assertEquals(300, (int) clientStatusHashMap.get("id"));
LOG.info("Client Status: {} \n", clientStatusHashMap); LOG.info("Client Status: {} \n", clientStatusHashMap);
} }
public static void verifyClientWithdrawn(final HashMap<String, Object> clientStatusHashMap) { public static void verifyClientWithdrawn(final HashMap<String, Object> clientStatusHashMap) {
LOG.info( LOG.info(
"\n-------------------------------------- VERIFYING CLIENT IS WITHDRAWN ------------------------------------"); "\n-------------------------------------- VERIFYING CLIENT IS WITHDRAWN ------------------------------------");
assertEquals((int) clientStatusHashMap.get("id"), 800); assertEquals(800, (int) clientStatusHashMap.get("id"));
LOG.info("Client Status: {} \n", clientStatusHashMap); LOG.info("Client Status: {} \n", clientStatusHashMap);
} }
@@ -202,7 +202,7 @@ public class FundsIntegrationTest {
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build(); ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
String jsonData = FundsResourceHandler.retrieveFund(Long.MAX_VALUE, this.requestSpec, responseSpec); String jsonData = FundsResourceHandler.retrieveFund(Long.MAX_VALUE, this.requestSpec, responseSpec);
HashMap<String, Object> map = new Gson().fromJson(jsonData, new TypeToken<HashMap<String, Object>>(){}.getType()); 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 @Test
@@ -94,7 +94,7 @@ public class LoanDisbursementDetailsIntegrationTest {
loanIDWithEmi, "repaymentSchedule"); loanIDWithEmi, "repaymentSchedule");
ArrayList<HashMap> periods = (ArrayList<HashMap>) repaymentScheduleWithEmi.get("periods"); ArrayList<HashMap> periods = (ArrayList<HashMap>) repaymentScheduleWithEmi.get("periods");
assertEquals(periods.size(), 15); assertEquals(15, periods.size());
this.validateRepaymentScheduleWithEMI(periods); this.validateRepaymentScheduleWithEMI(periods);
@@ -115,7 +115,7 @@ public class LoanDisbursementDetailsIntegrationTest {
loanIDWithoutEmi, "repaymentSchedule"); loanIDWithoutEmi, "repaymentSchedule");
ArrayList<HashMap> periods1 = (ArrayList<HashMap>) repaymentScheduleWithEmi.get("periods"); ArrayList<HashMap> periods1 = (ArrayList<HashMap>) repaymentScheduleWithEmi.get("periods");
assertEquals(periods1.size(), 15); assertEquals(15, periods1.size());
LOG.info("-----------------------------------LOAN CREATED WITHOUT EMI LOANID------------------------------------------------- {}" LOG.info("-----------------------------------LOAN CREATED WITHOUT EMI LOANID------------------------------------------------- {}"
, loanIDWithoutEmi); , loanIDWithoutEmi);
@@ -81,7 +81,7 @@ public class RolesTest {
assertEquals(disableRoleId, roleId); assertEquals(disableRoleId, roleId);
role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId); role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
assertEquals((Integer) role.get("id"), 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); assertEquals(disableRoleId, roleId);
role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId); role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
assertEquals((Integer) role.get("id"), roleId); assertEquals((Integer) role.get("id"), roleId);
assertEquals((Boolean) role.get("disabled"), true); assertEquals(true, (Boolean) role.get("disabled"));
LOG.info("--------------------------------- ENABLING ROLE -------------------------------"); LOG.info("--------------------------------- ENABLING ROLE -------------------------------");
final Integer enableRoleId = RolesHelper.enableRole(this.requestSpec, this.responseSpec, roleId); final Integer enableRoleId = RolesHelper.enableRole(this.requestSpec, this.responseSpec, roleId);
assertEquals(enableRoleId, roleId); assertEquals(enableRoleId, roleId);
role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId); role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
assertEquals((Integer) role.get("id"), roleId); assertEquals((Integer) role.get("id"), roleId);
assertEquals((Boolean) role.get("disabled"), false); assertEquals(false,(Boolean) role.get("disabled"));
} }
@@ -55,7 +55,7 @@ public class StaffTest {
Map<String, Object> response = StaffHelper.createStaffMap(requestSpec, responseSpec); Map<String, Object> response = StaffHelper.createStaffMap(requestSpec, responseSpec);
Assert.assertNotNull(response); Assert.assertNotNull(response);
Assert.assertEquals(response.get("officeId"), 1); Assert.assertEquals(1, response.get("officeId"));
Assert.assertNotNull(response.get("resourceId")); Assert.assertNotNull(response.get("resourceId"));
} }
@@ -120,7 +120,7 @@ public class StaffTest {
Map<String, Object> response = StaffHelper.getStaff(requestSpec, responseSpec, 1); Map<String, Object> response = StaffHelper.getStaff(requestSpec, responseSpec, 1);
Assert.assertNotNull(response); Assert.assertNotNull(response);
Assert.assertNotNull(response.get("id")); Assert.assertNotNull(response.get("id"));
Assert.assertEquals(response.get("id"), 1); Assert.assertEquals(1, response.get("id"));
} }
@Test @Test
@@ -138,7 +138,7 @@ public class StaffTest {
List<Map<String, Object>> responseActive = StaffHelper.getStaffListWithState(requestSpec, responseSpec, "active"); List<Map<String, Object>> responseActive = StaffHelper.getStaffListWithState(requestSpec, responseSpec, "active");
for(final Map<String, Object> staff : responseActive) { for(final Map<String, Object> staff : responseActive) {
Assert.assertNotNull(staff.get("id")); 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"); List<Map<String, Object>> responseInactive = StaffHelper.getStaffListWithState(requestSpec, responseSpec, "inactive");
for(final Map<String, Object> staff : responseInactive) { for(final Map<String, Object> staff : responseInactive) {
Assert.assertNotNull(staff.get("id")); 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, final HashMap codeValueChanges = (HashMap) CodeHelper.updateCodeValue(this.requestSpec, this.responseSpec, createCodeResponseId,
createCodeValueResponseId1, codeValue1 + "CHANGE", codeDescription1 + "CHANGE", 4, "changes"); 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 // delete code value
Integer deletedCodeValueResponseId1 = (Integer) CodeHelper.deleteCodeValueById(this.requestSpec, this.generalResponseSpec, Integer deletedCodeValueResponseId1 = (Integer) CodeHelper.deleteCodeValueById(this.requestSpec, this.generalResponseSpec,
@@ -427,6 +427,6 @@ public class BatchHelper {
LOG.info("------------------------------CHECK CLIENT DETAILS------------------------------------\n"); LOG.info("------------------------------CHECK CLIENT DETAILS------------------------------------\n");
final String CLIENT_URL = "/fineract-provider/api/v1/clients?externalId=" + externalId + "&" + Utils.TENANT_IDENTIFIER; final String CLIENT_URL = "/fineract-provider/api/v1/clients?externalId=" + externalId + "&" + Utils.TENANT_IDENTIFIER;
final Integer responseRecords = Utils.performServerGet(requestSpec, responseSpec, CLIENT_URL, "totalFilteredRecords"); 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 * @param expectedAmount
*/ */
private void isValidOutstandingAmount(Object outStandingAmount, Object 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.notificationGeneratorWritePlatformService, times(1)).create(refEq(notification, "createdAt"));
verify(this.notificationMapperWritePlatformService, times(1)).create(refEq(notificationMapper, "createdAt")); verify(this.notificationMapperWritePlatformService, times(1)).create(refEq(notificationMapper, "createdAt"));
verify(this.notificationGeneratorReadRepositoryWrapper, times(1)).findById(1L); verify(this.notificationGeneratorReadRepositoryWrapper, times(1)).findById(1L);
assertEquals(actualGeneratedNotificationId, Long.valueOf(1)); assertEquals(Long.valueOf(1),actualGeneratedNotificationId);
} }
private String getCurrentDateTime() { private String getCurrentDateTime() {