FINERACT-723: Fixed to use the right date in more tests

This commit is contained in:
Petri Tuomola
2020-06-17 22:07:19 +02:00
committed by Michael Vorburger ⛑️
parent 520ee5b82d
commit d3b6a3574c
5 changed files with 14 additions and 19 deletions
@@ -37,7 +37,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.CommonConstants;
import org.apache.fineract.integrationtests.common.SchedulerJobHelper;
@@ -2070,7 +2069,7 @@ public class ClientSavingsIntegrationTest {
error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
Integer releaseTransactionId = this.savingsAccountHelper.releaseAmount(savingsId, holdTransactionId);
Date today = DateUtils.getDateOfTenant();
Date today = Utils.getLocalDateOfTenant().toDate();
String todayDate = today.toString();
SimpleDateFormat dt1 = new SimpleDateFormat("dd MMM yyyy");
todayDate = dt1.format(today).toString();
@@ -28,7 +28,7 @@ import io.restassured.specification.ResponseSpecification;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import org.apache.fineract.integrationtests.common.ClientHelper;
@@ -123,8 +123,8 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
ClientStatusChecker.verifyClientPending(status);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todaysDate = Calendar.getInstance();
final String undoRejectDate = dateFormat.format(todaysDate.getTime());
Date todaysDate = Utils.getLocalDateOfTenant().toDate();
final String undoRejectDate = dateFormat.format(todaysDate);
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoRejectedclient(clientId,
CommonConstants.RESPONSE_ERROR, undoRejectDate);
@@ -155,9 +155,8 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
status = this.clientHelper.rejectClient(clientId);
ClientStatusChecker.verifyClientRejected(status);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.DATE, 1);
final String undoRejectDate = dateFormat.format(todaysDate.getTime());
Date tomorrowsDate = Utils.getLocalDateOfTenant().plusDays(1).toDate();
final String undoRejectDate = dateFormat.format(tomorrowsDate);
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId,
CommonConstants.RESPONSE_ERROR, undoRejectDate);
assertEquals("validation.msg.client.reopenedDate.is.greater.than.date",
@@ -232,8 +231,8 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todaysDate = Calendar.getInstance();
final String undoWithdrawDate = dateFormat.format(todaysDate.getTime());
Date todaysDate = Utils.getLocalDateOfTenant().toDate();
final String undoWithdrawDate = dateFormat.format(todaysDate);
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId,
CommonConstants.RESPONSE_ERROR, undoWithdrawDate);
@@ -264,9 +263,8 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
status = this.clientHelper.withdrawClient(clientId);
ClientStatusChecker.verifyClientWithdrawn(status);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.DATE, 1);
final String undoWithdrawDate = dateFormat.format(todaysDate.getTime());
Date tomorrowsDate = Utils.getLocalDateOfTenant().plusDays(1).toDate();
final String undoWithdrawDate = dateFormat.format(tomorrowsDate);
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId,
CommonConstants.RESPONSE_ERROR, undoWithdrawDate);
assertEquals("validation.msg.client.reopenedDate.is.greater.than.date",
@@ -758,9 +758,9 @@ public class GroupSavingsIntegrationTest {
LocalDate expectedNextDueDate = new LocalDate((Integer) dates.get(0), (Integer) dates.get(1), (Integer) dates.get(2))
.plusWeeks((Integer) paidCharge.get("feeInterval"));
assertEquals(expectedNextDueDate, nextDueDate);
cal = Calendar.getInstance();
this.savingsAccountHelper.closeSavingsAccountAndGetBackRequiredField(savingsId, "true", null, sdf.format(cal.getTime()));
this.savingsAccountHelper.closeSavingsAccountAndGetBackRequiredField(savingsId, "true", null,
sdf.format(Utils.getLocalDateOfTenant().toDate()));
}
@@ -21,7 +21,6 @@ package org.apache.fineract.integrationtests.common;
import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.HashMap;
import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -154,7 +153,7 @@ public class CenterDomain implements Comparable<CenterDomain> {
} else {
map.put("active", "false");
if (submittedDate == null) {
map.put("submittedOnDate", DateUtils.getDateOfTenant());
map.put("submittedOnDate", Utils.getLocalDateOfTenant().toDate());
} else {
map.put("submittedOnDate", submittedDate);
}
@@ -32,7 +32,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.Utils;
import org.apache.fineract.integrationtests.common.charges.ChargesHelper;
@@ -273,7 +272,7 @@ public class ShareAccountIntegrationTests {
} else if (transactionType.equals("charge.payment")) {
Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount")));
Assertions.assertEquals("0", String.valueOf(transaction.get("amountPaid")));
Date transactionDate = DateUtils.getDateOfTenant();
Date transactionDate = Utils.getLocalDateOfTenant().toDate();
Assertions.assertEquals(simple.format(transactionDate), simple.format(date));
}
}