fix broken tests under JUnit 5 [FINERACT-1021]
This commit is contained in:
committed by
Michael Vorburger ⛑️
parent
508e915b4f
commit
67e6e27b54
@@ -119,6 +119,7 @@ dependencies {
|
||||
//
|
||||
testImplementation( 'org.mockito:mockito-core',
|
||||
'org.mockito:mockito-junit-jupiter',
|
||||
'org.junit.platform:junit-platform-runner', // required to be able to run tests directly under Eclipse, see FINERACT-943 & FINERACT-1021
|
||||
'io.github.classgraph:classgraph',
|
||||
'org.awaitility:awaitility'
|
||||
)
|
||||
|
||||
+2
-7
@@ -56,17 +56,12 @@ public class BatchApiTest {
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
|
||||
public BatchApiTest() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the essential settings for the TEST like contentType,
|
||||
* expectedStatusCode. It uses the '@BeforeEach' annotation provided by jUnit.
|
||||
*/
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
|
||||
Utils.initializeRESTAssured();
|
||||
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
|
||||
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
|
||||
@@ -189,8 +184,8 @@ public class BatchApiTest {
|
||||
final JsonObject changes = new FromJsonHelper().parse(response.get(1).getBody()).getAsJsonObject().get("changes").getAsJsonObject();
|
||||
|
||||
// Asserts the client information is successfully updated
|
||||
Assertions.assertEquals("Verify Firstname", "TestFirstName", changes.get("firstname").getAsString());
|
||||
Assertions.assertEquals("Verify Lastname", "TestLastName", changes.get("lastname").getAsString());
|
||||
Assertions.assertEquals("TestFirstName", changes.get("firstname").getAsString());
|
||||
Assertions.assertEquals("TestLastName", changes.get("lastname").getAsString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+7
-12
@@ -916,16 +916,16 @@ public class ClientLoanIntegrationTest {
|
||||
Float.valueOf(twoDForm.format(Float.valueOf(String.valueOf(chargeDetail.get("amountWaived")))))) == 0);
|
||||
}
|
||||
|
||||
public void validateNumberForEqual(String val, String val2) {
|
||||
private void validateNumberForEqual(String val, String val2) {
|
||||
Assertions.assertTrue(Float.valueOf(val).compareTo(Float.valueOf(val2)) == 0);
|
||||
}
|
||||
|
||||
public void validateNumberForEqualWithMsg(String msg, String val, String val2) {
|
||||
private void validateNumberForEqualWithMsg(String msg, String val, String val2) {
|
||||
Assertions.assertTrue(Float.valueOf(val).compareTo(Float.valueOf(val2)) == 0,
|
||||
msg + "expected " + val + " but was " + val2);
|
||||
}
|
||||
|
||||
public void validateNumberForEqualExcludePrecission(String val, String val2) {
|
||||
private void validateNumberForEqualExcludePrecission(String val, String val2) {
|
||||
DecimalFormat twoDForm = new DecimalFormat("#");
|
||||
Assertions.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(val)))
|
||||
.compareTo(Float.valueOf(twoDForm.format(Float.valueOf(val2)))) == 0);
|
||||
@@ -1266,8 +1266,7 @@ public class ClientLoanIntegrationTest {
|
||||
assertEquals(new ArrayList<>(Arrays.asList(2014, 7, 2)),
|
||||
loanSchedule.get(1).get("dueDate"),
|
||||
"Checking for Due Date for 1st Month");
|
||||
validateNumberForEqualWithMsg(String.valueOf(loanSchedule.get(1).get("principalOriginalDue")),
|
||||
"Checking for Principal Due for 1st Month", "0.0");
|
||||
validateNumberForEqualWithMsg("Checking for Principal Due for 1st Month", String.valueOf(loanSchedule.get(1).get("principalOriginalDue")), "0.0");
|
||||
assertEquals(Float.valueOf("200000"),
|
||||
loanSchedule.get(1).get("interestOriginalDue"),
|
||||
"Checking for Interest Due for 1st Month");
|
||||
@@ -1275,8 +1274,7 @@ public class ClientLoanIntegrationTest {
|
||||
assertEquals(new ArrayList<>(Arrays.asList(2014, 8, 2)),
|
||||
loanSchedule.get(2).get("dueDate"),
|
||||
"Checking for Due Date for 2nd Month");
|
||||
validateNumberForEqualWithMsg("0.0", String.valueOf(loanSchedule.get(2).get("principalOriginalDue")),
|
||||
"Checking for Principal Due for 2nd Month");
|
||||
validateNumberForEqualWithMsg("Checking for Principal Due for 2nd Month", "0.0", String.valueOf(loanSchedule.get(2).get("principalOriginalDue")));
|
||||
assertEquals(Float.valueOf("200000"),
|
||||
loanSchedule.get(2).get("interestOriginalDue"),
|
||||
"Checking for Interest Due for 2nd Month");
|
||||
@@ -1284,16 +1282,14 @@ public class ClientLoanIntegrationTest {
|
||||
assertEquals(new ArrayList<>(Arrays.asList(2014, 9, 2)),
|
||||
loanSchedule.get(3).get("dueDate"),
|
||||
"Checking for Due Date for 3rd Month");
|
||||
validateNumberForEqualWithMsg("0.0", String.valueOf(loanSchedule.get(3).get("principalDue")),
|
||||
"Checking for Principal Due for 3rd Month");
|
||||
validateNumberForEqualWithMsg("Checking for Principal Due for 3rd Month", "0.0", String.valueOf(loanSchedule.get(3).get("principalDue")));
|
||||
assertEquals(Float.valueOf("200000"), loanSchedule.get(3).get("interestOriginalDue"),
|
||||
"Checking for Interest Due for 3rd Month");
|
||||
|
||||
assertEquals(new ArrayList<>(Arrays.asList(2014, 10, 2)),
|
||||
loanSchedule.get(4).get("dueDate"),
|
||||
"Checking for Due Date for 4th Month");
|
||||
validateNumberForEqualWithMsg("0", String.valueOf(loanSchedule.get(4).get("principalDue")),
|
||||
"Checking for Principal Due for 4th Month");
|
||||
validateNumberForEqualWithMsg("Checking for Principal Due for 4th Month", "0", String.valueOf(loanSchedule.get(4).get("principalDue")));
|
||||
assertEquals(Float.valueOf("200000"),
|
||||
loanSchedule.get(4).get("interestOriginalDue"),
|
||||
"Checking for Interest Due for 4th Month");
|
||||
@@ -1356,7 +1352,6 @@ public class ClientLoanIntegrationTest {
|
||||
assertEquals(Float.valueOf("10500"),
|
||||
loanSchedule.get(24).get("interestOriginalDue"),
|
||||
"Checking for Interest Due for 24th Month");
|
||||
|
||||
}
|
||||
|
||||
private void addCharges(List<HashMap> charges, Integer chargeId, String amount, String duedate) {
|
||||
|
||||
+4
-4
@@ -74,7 +74,7 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
|
||||
|
||||
final Integer savingsId = createSavingsAccount(clientID, startDate);
|
||||
|
||||
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "1000", startDate,
|
||||
this.savingsAccountHelper.depositToSavingsAccount(savingsId, "1000", startDate,
|
||||
CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
|
||||
/***
|
||||
@@ -86,12 +86,12 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
|
||||
ArrayList<HashMap<String, Object>> transactions = (ArrayList<HashMap<String, Object>>) accountDetails.get("transactions");
|
||||
HashMap<String, Object> interestPostingTransaction = transactions.get(transactions.size() - 2);
|
||||
for (Entry<String, Object> entry : interestPostingTransaction.entrySet())
|
||||
{LOG.info("{} - {}",entry.getKey(), entry.getValue().toString());}
|
||||
{LOG.info("{} - {}",entry.getKey(), entry.getValue().toString());}
|
||||
// 1st Dec 13 to 31st March 14 - 365 days, daily compounding using daily
|
||||
// balance
|
||||
// 33.7016 obtained from formula in excel provided by Subramanya
|
||||
assertEquals("Equality check for interest posted amount", "33.7016", interestPostingTransaction.get("amount").toString());
|
||||
assertEquals("Date check for Interest Posting transaction", "[2014, 3, 31]", interestPostingTransaction.get("date").toString());
|
||||
assertEquals("33.7016", interestPostingTransaction.get("amount").toString(), "Equality check for interest posted amount");
|
||||
assertEquals("[2014, 3, 31]", interestPostingTransaction.get("date").toString(), "Date check for Interest Posting transaction");
|
||||
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -54,10 +54,10 @@ public class LoanRescheduleRequestTest {
|
||||
private Integer loanProductId;
|
||||
private Integer loanId;
|
||||
private Integer loanRescheduleRequestId;
|
||||
private String loanPrincipalAmount = "100000.00";
|
||||
private String numberOfRepayments = "12";
|
||||
private String interestRatePerPeriod = "18";
|
||||
private String dateString = "4 September 2014";
|
||||
private final String loanPrincipalAmount = "100000.00";
|
||||
private final String numberOfRepayments = "12";
|
||||
private final String interestRatePerPeriod = "18";
|
||||
private final String dateString = "4 September 2014";
|
||||
|
||||
@BeforeEach
|
||||
public void initialize() {
|
||||
@@ -212,8 +212,8 @@ public class LoanRescheduleRequestTest {
|
||||
final HashMap loanSummary = this.loanTransactionHelper.getLoanSummary(requestSpec, generalResponseSpec, loanId);
|
||||
final Float totalExpectedRepayment = (Float) loanSummary.get("totalExpectedRepayment");
|
||||
|
||||
assertEquals("NUMBER OF REPAYMENTS SHOULD BE 16, NOT 12", "12", numberOfRepayments.toString());
|
||||
assertEquals("TOTAL EXPECTED REPAYMENT MUST BE EQUAL TO 118000.0", "118000.0", totalExpectedRepayment.toString());
|
||||
assertEquals(12, numberOfRepayments, "NUMBER OF REPAYMENTS is NOK");
|
||||
assertEquals(118000, totalExpectedRepayment, "TOTAL EXPECTED REPAYMENT is NOK");
|
||||
|
||||
LOG.info("Successfully approved loan reschedule request (ID: {})" , this.loanRescheduleRequestId);
|
||||
}
|
||||
|
||||
-5
@@ -49,7 +49,6 @@ import org.slf4j.LoggerFactory;
|
||||
* Entity Datatable Checks Integration Test for checking Creation, Deletion and
|
||||
* Retrieval of Entity-Datatable Check
|
||||
*/
|
||||
|
||||
public class EntityDatatableChecksIntegrationTest {
|
||||
private final static Logger LOG = LoggerFactory.getLogger(EntityDatatableChecksIntegrationTest.class);
|
||||
private RequestSpecification requestSpec;
|
||||
@@ -70,10 +69,6 @@ public class EntityDatatableChecksIntegrationTest {
|
||||
|
||||
public static final String DATE_TIME_FORMAT = "dd MMMM yyyy HH:mm";
|
||||
|
||||
public EntityDatatableChecksIntegrationTest() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
Utils.initializeRESTAssured();
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ public class DatatableHelper {
|
||||
LOG.info("------------------------------CHECK DATATABLE DETAILS------------------------------------\n");
|
||||
final String responseRegisteredTableName = Utils.performServerGet(requestSpec, responseSpec, DATATABLE_URL + "/"
|
||||
+ generatedDatatableName + "?" + Utils.TENANT_IDENTIFIER, "registeredTableName");
|
||||
assertEquals("ERROR IN CREATING THE DATATABLE", generatedDatatableName, responseRegisteredTableName);
|
||||
assertEquals(generatedDatatableName, responseRegisteredTableName, "ERROR IN CREATING THE DATATABLE");
|
||||
}
|
||||
|
||||
public static String getTestDatatableAsJSON(final String apptableName, final boolean multiRow) {
|
||||
|
||||
Reference in New Issue
Block a user