You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by vo...@apache.org on 2020/06/17 20:07:28 UTC
[fineract] branch develop updated: FINERACT-723: Fixed to use the
right date in more tests
This is an automated email from the ASF dual-hosted git repository.
vorburger pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
The following commit(s) were added to refs/heads/develop by this push:
new d3b6a35 FINERACT-723: Fixed to use the right date in more tests
d3b6a35 is described below
commit d3b6a3574ccd5cd42688d39452635f687450a5da
Author: Petri Tuomola <pe...@tuomola.org>
AuthorDate: Mon Jun 15 12:27:00 2020 +0300
FINERACT-723: Fixed to use the right date in more tests
---
.../ClientSavingsIntegrationTest.java | 3 +--
...ClientUndoRejectAndWithdrawalIntegrationTest.java | 20 +++++++++-----------
.../GroupSavingsIntegrationTest.java | 4 ++--
.../integrationtests/common/CenterDomain.java | 3 +--
.../common/shares/ShareAccountIntegrationTests.java | 3 +--
5 files changed, 14 insertions(+), 19 deletions(-)
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientSavingsIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientSavingsIntegrationTest.java
index 8f0aff5..cbf1687 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientSavingsIntegrationTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientSavingsIntegrationTest.java
@@ -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();
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientUndoRejectAndWithdrawalIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientUndoRejectAndWithdrawalIntegrationTest.java
index 4902dfb..024c710 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientUndoRejectAndWithdrawalIntegrationTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientUndoRejectAndWithdrawalIntegrationTest.java
@@ -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",
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GroupSavingsIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GroupSavingsIntegrationTest.java
index cd984e8..613c872 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GroupSavingsIntegrationTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GroupSavingsIntegrationTest.java
@@ -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()));
}
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CenterDomain.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CenterDomain.java
index 20fc371..22fc139 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CenterDomain.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CenterDomain.java
@@ -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);
}
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/shares/ShareAccountIntegrationTests.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/shares/ShareAccountIntegrationTests.java
index 0110a4a..bfa5fd2 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/shares/ShareAccountIntegrationTests.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/shares/ShareAccountIntegrationTests.java
@@ -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));
}
}