Fix for Fixed Deposit Integration Test

This commit is contained in:
Jose Alberto Hernandez
2022-07-03 21:34:34 +02:00
committed by Arnold Gálovics
parent ac17e993b6
commit b9e30e2e82
3 changed files with 11 additions and 10 deletions
@@ -8,7 +8,7 @@
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -48,7 +48,6 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuild
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
import org.apache.fineract.infrastructure.core.exception.PlatformServiceUnavailableException;
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.apache.fineract.infrastructure.jobs.annotation.CronTarget;
import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException;
@@ -148,7 +147,6 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
private final HolidayRepositoryWrapper holidayRepository;
private final WorkingDaysRepositoryWrapper workingDaysRepository;
private final DepositAccountOnHoldTransactionRepository depositAccountOnHoldTransactionRepository;
private final FromJsonHelper fromApiJsonHelper;
@Autowired
public DepositAccountWritePlatformServiceJpaRepositoryImpl(final PlatformSecurityContext context,
@@ -168,8 +166,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
final AccountTransfersWritePlatformService accountTransfersWritePlatformService,
final DepositAccountReadPlatformService depositAccountReadPlatformService,
final CalendarInstanceRepository calendarInstanceRepository, final ConfigurationDomainService configurationDomainService,
final DepositAccountOnHoldTransactionRepository depositAccountOnHoldTransactionRepository,
final FromJsonHelper fromApiJsonHelper) {
final DepositAccountOnHoldTransactionRepository depositAccountOnHoldTransactionRepository) {
this.context = context;
this.savingAccountRepositoryWrapper = savingAccountRepositoryWrapper;
@@ -193,7 +190,6 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
this.calendarInstanceRepository = calendarInstanceRepository;
this.configurationDomainService = configurationDomainService;
this.depositAccountOnHoldTransactionRepository = depositAccountOnHoldTransactionRepository;
this.fromApiJsonHelper = fromApiJsonHelper;
}
@Transactional
@@ -38,6 +38,7 @@ import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.CommonConstants;
@@ -112,6 +113,8 @@ public class FixedDepositTest {
// and then to compare the exact results
public static final Float THRESHOLD = 1.0f;
private TimeZone systemTimeZone;
@BeforeEach
public void setup() {
Utils.initializeRESTAssured();
@@ -121,6 +124,8 @@ public class FixedDepositTest {
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec);
this.financialActivityAccountHelper = new FinancialActivityAccountHelper(this.requestSpec);
this.systemTimeZone = TimeZone.getTimeZone(Utils.TENANT_TIME_ZONE);
}
/***
@@ -1568,10 +1573,10 @@ public class FixedDepositTest {
Calendar activationDate = Calendar.getInstance();
activationDate.add(Calendar.MONTH, -1);
activationDate.add(Calendar.DAY_OF_MONTH, -1);
ZonedDateTime startDate = ZonedDateTime.ofInstant(activationDate.getTime().toInstant(), Utils.getZoneIdOfTenant());
ZonedDateTime startDate = ZonedDateTime.ofInstant(activationDate.getTime().toInstant(), this.systemTimeZone.toZoneId());
Calendar prematureClosureDate = Calendar.getInstance();
ZonedDateTime endDate = ZonedDateTime.ofInstant(prematureClosureDate.getTime().toInstant(), Utils.getZoneIdOfTenant());
ZonedDateTime endDate = ZonedDateTime.ofInstant(prematureClosureDate.getTime().toInstant(), this.systemTimeZone.toZoneId());
Integer depositedPeriod = Math.toIntExact(ChronoUnit.MONTHS.between(startDate.toLocalDate(), endDate.toLocalDate()));
@@ -1682,10 +1687,10 @@ public class FixedDepositTest {
Calendar activationDate = Calendar.getInstance();
activationDate.add(Calendar.MONTH, -1);
activationDate.add(Calendar.DAY_OF_MONTH, -1);
ZonedDateTime startDate = ZonedDateTime.ofInstant(activationDate.getTime().toInstant(), Utils.getZoneIdOfTenant());
ZonedDateTime startDate = ZonedDateTime.ofInstant(activationDate.getTime().toInstant(), this.systemTimeZone.toZoneId());
Calendar prematureClosureDate = Calendar.getInstance();
ZonedDateTime endDate = ZonedDateTime.ofInstant(prematureClosureDate.getTime().toInstant(), Utils.getZoneIdOfTenant());
ZonedDateTime endDate = ZonedDateTime.ofInstant(prematureClosureDate.getTime().toInstant(), this.systemTimeZone.toZoneId());
Integer depositedPeriod = Math.toIntExact(ChronoUnit.MONTHS.between(startDate.toLocalDate(), endDate.toLocalDate()));