Fixes integration tests

FINERACT-1557: Fixes for integration tests

FINERACT-1557: Fixes for integration tests

Fixes integration tests
This commit is contained in:
Jose Hernandez
2022-04-14 00:37:55 +02:00
committed by Aleksandar Vidakovic
parent eb11c32ee3
commit 3d3e8c4083
34 changed files with 425 additions and 157 deletions
@@ -40,6 +40,7 @@ import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.apache.fineract.integrationtests.common.ClientHelper;
@@ -3399,7 +3400,7 @@ public class ClientLoanIntegrationTest {
public void testLoanScheduleWithInterestRecalculation_WITH_REST_SAME_AS_REPAYMENT_INTEREST_COMPOUND_NONE_STRATEGY_REDUCE_EMI() {
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
Calendar todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
@@ -3509,7 +3510,7 @@ public class ClientLoanIntegrationTest {
private void testLoanScheduleWithInterestRecalculation_WITH_REST_SAME_AS_REPAYMENT_INTEREST_COMPOUND_NONE_STRATEGY_REDUCE_EMI_PRE_CLOSE_INTEREST(
String preCloseInterestStrategy, String preCloseAmount) {
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
Calendar todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
@@ -3590,7 +3591,7 @@ public class ClientLoanIntegrationTest {
public void testLoanScheduleWithInterestRecalculation_WITH_REST_SAME_AS_REPAYMENT_INTEREST_COMPOUND_NONE_STRATEGY_REDUCE_EMI_WITH_INSTALLMENT_CHARGE() {
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
Calendar todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
@@ -3688,7 +3689,7 @@ public class ClientLoanIntegrationTest {
public void testLoanScheduleWithInterestRecalculation_WITH_REST_DAILY_INTEREST_COMPOUND_INTEREST_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS() {
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
Calendar todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
@@ -3802,7 +3803,7 @@ public class ClientLoanIntegrationTest {
public void testLoanScheduleWithInterestRecalculation_WITH_REST_WEEKLY_INTEREST_COMPOUND_INTEREST_FEE_STRATEGY_REDUCE_NEXT_INSTALLMENTS() {
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
Calendar todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
@@ -3939,7 +3940,7 @@ public class ClientLoanIntegrationTest {
String preCloseInterestStrategy, String preCloseAmount) {
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
Calendar todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
@@ -4041,7 +4042,7 @@ public class ClientLoanIntegrationTest {
throws InterruptedException {
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
Calendar todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
@@ -4157,7 +4158,7 @@ public class ClientLoanIntegrationTest {
this.periodicAccrualAccountingHelper = new PeriodicAccrualAccountingHelper(this.requestSpec, this.responseSpec);
this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
final Account assetAccount = this.accountHelper.createAssetAccount();
@@ -4263,7 +4264,7 @@ public class ClientLoanIntegrationTest {
public void testLoanScheduleWithInterestRecalculation_WITH_CURRENT_REPAYMENT_BASED_ARREARS_AGEING() {
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
Calendar todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
@@ -4345,7 +4346,7 @@ public class ClientLoanIntegrationTest {
public void testLoanScheduleWithInterestRecalculation_WITH_ORIGINAL_REPAYMENT_BASED_ARREARS_AGEING() {
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
Calendar todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
@@ -4440,7 +4441,7 @@ public class ClientLoanIntegrationTest {
final String preCloseAmount) {
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
Calendar todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
@@ -5390,7 +5391,7 @@ public class ClientLoanIntegrationTest {
public void testLoanScheduleWithInterestRecalculation_WITH_INTEREST_FIRST_STRATEGY_AND_REST_DAILY_INTEREST_COMPOUND_INTEREST_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS() {
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
Calendar todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
@@ -5505,7 +5506,7 @@ public class ClientLoanIntegrationTest {
public void testLoanScheduleWithInterestRecalculation_WITH_INTEREST_FIRST_STRATEGY_AND_REST_DAILY_INTEREST_COMPOUND_INTEREST_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS_EARLY_REPAYMENT() {
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
Calendar todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
@@ -374,7 +374,7 @@ public class ClientSavingsIntegrationTest {
balance -= chargeAmt;
assertEquals(balance, summary.get("accountBalance"), "Verifying opening Balance");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todaysDate = Calendar.getInstance();
final String TRANSACTION_DATE = dateFormat.format(todaysDate.getTime());
final String withdrawAmt = "800";
@@ -2284,7 +2284,7 @@ public class ClientSavingsIntegrationTest {
assertEquals(balance, summary.get("availableBalance"), "Verifying available Balance is -1000");
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "1200",
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todaysDate = Calendar.getInstance();
final String TRANSACTION_DATE = dateFormat.format(todaysDate.getTime());
@@ -2348,7 +2348,7 @@ public class ClientSavingsIntegrationTest {
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "1200",
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todaysDate = Calendar.getInstance();
final String TRANSACTION_DATE = dateFormat.format(todaysDate.getTime());
@@ -2412,7 +2412,7 @@ public class ClientSavingsIntegrationTest {
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "1100",
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todaysDate = Calendar.getInstance();
final String TRANSACTION_DATE = dateFormat.format(todaysDate.getTime());
@@ -2488,7 +2488,7 @@ public class ClientSavingsIntegrationTest {
// hold
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todaysDate = Calendar.getInstance();
final String TRANSACTION_DATE = dateFormat.format(todaysDate.getTime());
@@ -31,6 +31,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Locale;
import org.apache.fineract.integrationtests.common.CalendarHelper;
import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.GroupHelper;
@@ -69,7 +70,7 @@ public class DisbursalAndRepaymentScheduleTest {
private final String numberOfRepayments = "12";
private final String interestRatePerPeriod = "18";
private final SimpleDateFormat dateFormatterStandard = new SimpleDateFormat("dd MMMM yyyy");
private final SimpleDateFormat dateFormatterStandard = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
@BeforeEach
public void setup() {
@@ -31,6 +31,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.CollateralManagementHelper;
import org.apache.fineract.integrationtests.common.Utils;
@@ -436,7 +437,7 @@ public class LoanDisbursementDetailsIntegrationTest {
private String formatExpectedDisbursementDate(String expectedDisbursementDate) throws ParseException {
SimpleDateFormat source = new SimpleDateFormat("[yyyy, MM, dd]");
SimpleDateFormat target = new SimpleDateFormat("dd MMMM yyyy");
SimpleDateFormat target = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
String date = target.format(source.parse(expectedDisbursementDate));
return date;
@@ -36,6 +36,7 @@ import java.util.Arrays;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import org.apache.fineract.integrationtests.common.CalendarHelper;
import org.apache.fineract.integrationtests.common.CenterDomain;
import org.apache.fineract.integrationtests.common.CenterHelper;
@@ -103,7 +104,7 @@ public class LoanReschedulingWithinCenterTest {
associateClientsToGroup(groupId, clientId);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
Calendar today = Calendar.getInstance(Utils.getTimeZoneOfTenant());
today.add(Calendar.DAY_OF_MONTH, -14);
@@ -193,7 +194,7 @@ public class LoanReschedulingWithinCenterTest {
}
private Integer createCalendarMeeting(Integer centerId) {
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
Calendar today = Calendar.getInstance(Utils.getTimeZoneOfTenant());
final String startDate = dateFormat.format(today.getTime());
@@ -236,7 +237,7 @@ public class LoanReschedulingWithinCenterTest {
associateClientsToGroup(groupId, clientId);
// CREATE A LOAN PRODUCT
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
Calendar today = Calendar.getInstance(Utils.getTimeZoneOfTenant());
today.add(Calendar.DAY_OF_MONTH, -14);
@@ -33,6 +33,7 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.CollateralManagementHelper;
import org.apache.fineract.integrationtests.common.PaymentTypeDomain;
@@ -50,7 +51,7 @@ public class RepaymentWithPostDatedChecksTest {
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
private final SimpleDateFormat dateFormatterStandard = new SimpleDateFormat("dd MMMM yyyy");
private final SimpleDateFormat dateFormatterStandard = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
private LoanTransactionHelper loanTransactionHelper;
@BeforeEach
@@ -95,7 +96,7 @@ public class RepaymentWithPostDatedChecksTest {
List<HashMap> postDatedChecks = new ArrayList<>();
Gson gson = new Gson();
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
// Get the first installment date
@@ -509,7 +509,8 @@ public class SchedulerJobsTestResults {
"Verifying Loan Repayment in Advance after Running Update Loan Paid in Advance Scheduler Job");
}
// Invalid test case as it won't affect summary (Loan summary is properly updated before running this job)
// Invalid test case as it won't affect summary (Loan summary is properly
// updated before running this job)
@Disabled
@Test
public void testUpdateLoanSummaryJobOutcome() throws InterruptedException {
@@ -575,11 +576,12 @@ public class SchedulerJobsTestResults {
DateFormat monthDayFormat = new SimpleDateFormat("dd MMMM", Locale.US);
Calendar todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.WEEK_OF_YEAR, -1);
final String VALID_FROM = dateFormat.format(todaysDate.getTime());
final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime());
todaysDate.add(Calendar.WEEK_OF_YEAR, -1);
final String VALID_FROM = dateFormat.format(todaysDate.getTime());
todaysDate.add(Calendar.YEAR, 1);
final String VALID_TO = dateFormat.format(todaysDate.getTime());
@@ -880,7 +882,8 @@ public class SchedulerJobsTestResults {
private Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String minOpenningBalance) {
// system.out.println("------------------------------CREATING NEW SAVINGS PRODUCT
// system.out.println("------------------------------CREATING NEW SAVINGS
// PRODUCT
// ---------------------------------------");
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
final String savingsProductJSON = savingsProductHelper //
@@ -892,7 +895,8 @@ public class SchedulerJobsTestResults {
}
private Integer createSavingsProduct(final String minOpenningBalance, final Account... accounts) {
// system.out.println("------------------------------CREATING NEW SAVINGS PRODUCT
// system.out.println("------------------------------CREATING NEW SAVINGS
// PRODUCT
// ---------------------------------------");
final String savingsProductJSON = new SavingsProductHelper().withInterestCompoundingPeriodTypeAsDaily() //
.withInterestPostingPeriodTypeAsQuarterly() //
@@ -958,7 +962,8 @@ public class SchedulerJobsTestResults {
}
private Integer createFixedDepositProduct(final String validFrom, final String validTo) {
// system.out.println("------------------------------CREATING NEW FIXED DEPOSIT PRODUCT
// system.out.println("------------------------------CREATING NEW FIXED DEPOSIT
// PRODUCT
// ---------------------------------------");
FixedDepositProductHelper fixedDepositProductHelper = new FixedDepositProductHelper(requestSpec, responseSpec);
final String fixedDepositProductJSON = fixedDepositProductHelper //
@@ -970,7 +975,8 @@ public class SchedulerJobsTestResults {
private Integer applyForFixedDepositApplication(final String clientID, final String productID, final String submittedOnDate,
final String penalInterestType, String savingsId) {
// system.out.println("--------------------------------APPLYING FOR FIXED DEPOSIT ACCOUNT
// system.out.println("--------------------------------APPLYING FOR FIXED
// DEPOSIT ACCOUNT
// --------------------------------");
final String fixedDepositApplicationJSON = new FixedDepositAccountHelper(requestSpec, responseSpec)
.withSubmittedOnDate(submittedOnDate).withSavings(savingsId).transferInterest(true)
@@ -31,6 +31,7 @@ import java.io.OutputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import org.apache.fineract.infrastructure.bulkimport.constants.ClientEntityConstants;
@@ -105,7 +106,7 @@ public class ClientEntityImportHandlerTest {
Sheet staffSheet = workbook.getSheet(TemplatePopulateImportConstants.STAFF_SHEET_NAME);
firstClientRow.createCell(ClientEntityConstants.OFFICE_NAME_COL).setCellValue(staffSheet.getRow(1).getCell(0).getStringCellValue());
firstClientRow.createCell(ClientEntityConstants.STAFF_NAME_COL).setCellValue(staffSheet.getRow(1).getCell(1).getStringCellValue());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMMM yyyy");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Date incoporationDate = simpleDateFormat.parse("14 May 2001");
firstClientRow.createCell(ClientEntityConstants.INCOPORATION_DATE_COL).setCellValue(incoporationDate);
Date validTill = simpleDateFormat.parse("14 May 2019");
@@ -36,6 +36,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
@@ -178,7 +179,7 @@ public class LoanImportHandlerTest {
firstLoanRow.createCell(LoanConstants.CLIENT_EXTERNAL_ID).setCellValue(externalId);
firstLoanRow.createCell(LoanConstants.PRODUCT_COL).setCellValue(loanProductJson.getString("name"));
firstLoanRow.createCell(LoanConstants.LOAN_OFFICER_NAME_COL).setCellValue((String) staffMap.get("displayName"));
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMMM yyyy");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Date date = simpleDateFormat.parse("13 May 2017");
firstLoanRow.createCell(LoanConstants.SUBMITTED_ON_DATE_COL).setCellValue(date);
firstLoanRow.createCell(LoanConstants.APPROVED_DATE_COL).setCellValue(date);
@@ -30,6 +30,7 @@ import java.io.OutputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import org.apache.fineract.infrastructure.bulkimport.constants.OfficeConstants;
import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants;
import org.apache.fineract.integrationtests.common.OfficeHelper;
@@ -72,7 +73,7 @@ public class OfficeImportHandlerTest {
.setCellValue(firstOfficeRow.getCell(OfficeConstants.LOOKUP_OFFICE_COL).getStringCellValue());
firstOfficeRow.createCell(OfficeConstants.PARENT_OFFICE_ID_COL)
.setCellValue(firstOfficeRow.getCell(OfficeConstants.LOOKUP_OFFICE_ID_COL).getNumericCellValue());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMMM yyyy");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Date date = simpleDateFormat.parse("14 May 2001");
firstOfficeRow.createCell(OfficeConstants.OPENED_ON_COL).setCellValue(date);
@@ -33,6 +33,7 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
@@ -134,7 +135,7 @@ public class SavingsImportHandlerTest {
firstSavingsRow.createCell(SavingsConstants.PRODUCT_COL)
.setCellValue(savingsProductSheet.getRow(1).getCell(1).getStringCellValue());
firstSavingsRow.createCell(SavingsConstants.FIELD_OFFICER_NAME_COL).setCellValue((String) staffMap.get("displayName"));
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMMM yyyy");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Date date = simpleDateFormat.parse("13 May 2017");
firstSavingsRow.createCell(SavingsConstants.SUBMITTED_ON_DATE_COL).setCellValue(date);
firstSavingsRow.createCell(SavingsConstants.APPROVED_DATE_COL).setCellValue(date);
@@ -26,6 +26,7 @@ import io.restassured.specification.ResponseSpecification;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
import org.apache.fineract.integrationtests.common.charges.ChargesHelper;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
@@ -102,7 +103,7 @@ public class ClientChargesTest {
* Now pay client charge for 20 USD and ensure the outstanding amount is updated properly
*/
ResponseSpecification responseSpecFailure = new ResponseSpecBuilder().expectStatusCode(400).build();
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
Calendar today = Calendar.getInstance(Utils.getTimeZoneOfTenant());
today.add(Calendar.DAY_OF_MONTH, 2);
@@ -33,6 +33,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.apache.fineract.integrationtests.common.accounting.Account;
@@ -258,7 +259,7 @@ public class ProvisioningIntegrationTest {
String date = (String) item.get("createdDate");
DateFormat formatter = new SimpleDateFormat("MMM dd, yyyy");
Date date1 = formatter.parse(date);
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy");
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
String formattedString = simple
.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
Date currentDate = simple.parse(formattedString);
@@ -124,6 +124,12 @@ public class LoanTransactionHelper {
return (ArrayList) Utils.performServerGet(requestSpec, responseSpec, URL, "charges");
}
public ArrayList getLoanTransactions(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer loanID) {
final String URL = "/fineract-provider/api/v1/loans/" + loanID + "?associations=transactions&" + Utils.TENANT_IDENTIFIER;
return (ArrayList) Utils.performServerGet(requestSpec, responseSpec, URL, "transactions");
}
public ArrayList getLoanFutureRepaymentSchedule(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer loanID) {
final String URL = "/fineract-provider/api/v1/loans/" + loanID + "?associations=repaymentSchedule,futureSchedule&"
@@ -133,7 +139,7 @@ public class LoanTransactionHelper {
}
public HashMap getLoanSummary(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer loanID) {
final String URL = "/fineract-provider/api/v1/loans/" + loanID + "?associations=all&" + Utils.TENANT_IDENTIFIER;
final String URL = "/fineract-provider/api/v1/loans/" + loanID + "?" + Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, URL, "summary");
return response;
}
@@ -731,7 +737,7 @@ public class LoanTransactionHelper {
public void checkAccrualTransactionForRepayment(final LocalDate transactionDate, final Float interestPortion, final Float feePortion,
final Float penaltyPortion, final Integer loanID) {
ArrayList<HashMap> transactions = (ArrayList<HashMap>) getLoanDetail(this.requestSpec, this.responseSpec, loanID, "transactions");
ArrayList<HashMap> transactions = (ArrayList<HashMap>) getLoanTransactions(this.requestSpec, this.responseSpec, loanID);
boolean isTransactionFound = false;
for (int i = 0; i < transactions.size(); i++) {
HashMap transactionType = (HashMap) transactions.get(i).get("type");
@@ -26,6 +26,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.apache.fineract.integrationtests.common.Utils;
@@ -46,7 +47,7 @@ public final class ProvisioningHelper {
final HashMap<String, Object> map = new HashMap<>();
map.put("loanProducts", addLoanProducts(loanProducts));
map.put("definitions", addProvisioningCategories(categories, liability, expense));
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy");
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
String formattedString = simple
.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
@@ -61,7 +62,7 @@ public final class ProvisioningHelper {
map.put("createjournalentries", Boolean.FALSE);
map.put("locale", "en");
map.put("dateFormat", "dd MMMM yyyy");
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy");
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
map.put("date",
simple.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant())));
String provisioningEntryCreateJson = new Gson().toJson(map);
@@ -73,7 +74,7 @@ public final class ProvisioningHelper {
map.put("createjournalentries", Boolean.TRUE);
map.put("locale", "en");
map.put("dateFormat", "dd MMMM yyyy");
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy");
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
map.put("date",
simple.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant())));
String provisioningEntryCreateJson = new Gson().toJson(map);
@@ -250,12 +250,8 @@ public class ShareAccountIntegrationTests {
Assertions.assertEquals("shareAccountStatusType.rejected", String.valueOf(statusMap.get("code")));
Map<String, Object> timelineMap = (Map<String, Object>) shareAccountData.get("timeline");
List<Integer> dateList = (List<Integer>) timelineMap.get("rejectedDate");
Calendar cal = Calendar.getInstance();
cal.set(dateList.get(0), dateList.get(1) - 1, dateList.get(2));
Date rejectedDate = cal.getTime();
Assertions.assertEquals(
simple.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant())),
simple.format(rejectedDate));
Date rejectedDate = DateUtils.createDate(dateList.get(0), dateList.get(1), dateList.get(2));
Assertions.assertEquals(simple.format(DateUtils.convertLocalDateToDate(Utils.getLocalDateOfTenant())), simple.format(rejectedDate));
List<Map<String, Object>> transactions = (List<Map<String, Object>>) shareAccountData.get("purchasedShares");
Assertions.assertNotNull(transactions);
@@ -264,9 +260,7 @@ public class ShareAccountIntegrationTests {
Map<String, Object> transaction = transactions.get(i);
Map<String, Object> transactionTypeMap = (Map<String, Object>) transaction.get("type");
dateList = (List<Integer>) transaction.get("purchasedDate");
cal = Calendar.getInstance();
cal.set(dateList.get(0), dateList.get(1) - 1, dateList.get(2));
Date date = cal.getTime();
Date date = DateUtils.createDate(dateList.get(0), dateList.get(1), dateList.get(2));
String transactionType = (String) transactionTypeMap.get("code");
if (transactionType.equals("purchasedSharesType.purchased")) {
Assertions.assertEquals("25", String.valueOf(transaction.get("numberOfShares")));
@@ -25,6 +25,7 @@ import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.apache.fineract.integrationtests.common.Utils;
@@ -107,7 +108,7 @@ public class ShareProductHelper {
this.marketPrices = new ArrayList<>();
LocalDate currentDate = DateUtils.getLocalDateOfTenant();
String[] prices = { "3.0", "4.0", "5.0", "6.0", "7.0" };
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy");
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
for (int i = 0; i < prices.length; i++) {
currentDate = currentDate.plusMonths(2);
Map<String, String> marketPrice = new HashMap<>();
@@ -26,6 +26,7 @@ import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.apache.fineract.integrationtests.common.accounting.Account;
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
@@ -297,7 +298,7 @@ public class VariableInstallmentsDecliningBalanceHelper {
cal.set(Calendar.MONTH, (int) list.get(1) - 1);
cal.set(Calendar.DAY_OF_MONTH, (int) list.get(2));
Date date = cal.getTime();
DateFormat requiredFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat requiredFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
return requiredFormat.format(date);
}
@@ -26,6 +26,7 @@ import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.apache.fineract.integrationtests.common.accounting.Account;
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
@@ -208,7 +209,7 @@ public class VariableInstallmentsFlatHelper {
cal.set(Calendar.MONTH, (int) list.get(1) - 1);
cal.set(Calendar.DAY_OF_MONTH, (int) list.get(2));
Date date = cal.getTime();
DateFormat requiredFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat requiredFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
return requiredFormat.format(date);
}