adding null check for fixed deposit suggested amount for failing test cases
This commit is contained in:
+16
-12
@@ -59,14 +59,15 @@ public class InterestRateChartSlabFields {
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
public static InterestRateChartSlabFields createNew(String description, final SavingsPeriodFrequencyType periodFrequencyType, Integer fromPeriod, Integer toPeriod,
|
public static InterestRateChartSlabFields createNew(String description, final SavingsPeriodFrequencyType periodFrequencyType,
|
||||||
BigDecimal amountRangeFrom, BigDecimal amountRangeTo, BigDecimal annualInterestRate, String currencyCode) {
|
Integer fromPeriod, Integer toPeriod, BigDecimal amountRangeFrom, BigDecimal amountRangeTo, BigDecimal annualInterestRate,
|
||||||
|
String currencyCode) {
|
||||||
return new InterestRateChartSlabFields(description, periodFrequencyType, fromPeriod, toPeriod, amountRangeFrom, amountRangeTo,
|
return new InterestRateChartSlabFields(description, periodFrequencyType, fromPeriod, toPeriod, amountRangeFrom, amountRangeTo,
|
||||||
annualInterestRate, currencyCode);
|
annualInterestRate, currencyCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private InterestRateChartSlabFields(String description, final SavingsPeriodFrequencyType periodFrequencyType, Integer fromPeriod, Integer toPeriod,
|
private InterestRateChartSlabFields(String description, final SavingsPeriodFrequencyType periodFrequencyType, Integer fromPeriod,
|
||||||
BigDecimal amountRangeFrom, BigDecimal amountRangeTo, BigDecimal annualInterestRate, String currencyCode) {
|
Integer toPeriod, BigDecimal amountRangeFrom, BigDecimal amountRangeTo, BigDecimal annualInterestRate, String currencyCode) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.periodType = (periodFrequencyType == null) ? null : periodFrequencyType.getValue();
|
this.periodType = (periodFrequencyType == null) ? null : periodFrequencyType.getValue();
|
||||||
this.fromPeriod = fromPeriod;
|
this.fromPeriod = fromPeriod;
|
||||||
@@ -166,21 +167,19 @@ public class InterestRateChartSlabFields {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPeriodOverlapping(InterestRateChartSlabFields that) {
|
public boolean isPeriodOverlapping(InterestRateChartSlabFields that) {
|
||||||
if (that.toPeriod == null){
|
if (that.toPeriod == null) {
|
||||||
if (this.toPeriod == null){
|
if (this.toPeriod == null) { return true; }
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return that.fromPeriod <= this.toPeriod;
|
return that.fromPeriod <= this.toPeriod;
|
||||||
}
|
}
|
||||||
return this.fromPeriod <= that.toPeriod && that.fromPeriod <= this.toPeriod;
|
return this.fromPeriod <= that.toPeriod && that.fromPeriod <= this.toPeriod;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBetweenPeriod(final LocalDate periodStartDate, final LocalDate periodEndDate){
|
public boolean isBetweenPeriod(final LocalDate periodStartDate, final LocalDate periodEndDate) {
|
||||||
final Integer compare = depositPeriod(periodStartDate, periodEndDate);
|
final Integer compare = depositPeriod(periodStartDate, periodEndDate);
|
||||||
return (compare < this.fromPeriod || (this.toPeriod != null && compare > this.toPeriod)) ? false : true;
|
return (compare < this.fromPeriod || (this.toPeriod != null && compare > this.toPeriod)) ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAmountRangeProvided(){
|
public boolean isAmountRangeProvided() {
|
||||||
return (this.amountRangeFrom == null) ? false : true;
|
return (this.amountRangeFrom == null) ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,7 +210,12 @@ public class InterestRateChartSlabFields {
|
|||||||
return actualDepositPeriod;
|
return actualDepositPeriod;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAmountBetween(final BigDecimal depositAmount){
|
public boolean isAmountBetween(final BigDecimal depositAmount) {
|
||||||
return depositAmount.compareTo(amountRangeFrom) >= 0 && depositAmount.compareTo(amountRangeTo) <= 0;
|
if (amountRangeFrom != null && amountRangeTo != null) {
|
||||||
|
return depositAmount.compareTo(amountRangeFrom) >= 0 && depositAmount.compareTo(amountRangeTo) <= 0;
|
||||||
|
} else if (amountRangeFrom != null) {
|
||||||
|
return depositAmount.compareTo(amountRangeFrom) >= 0;
|
||||||
|
} else if (amountRangeTo != null) { return depositAmount.compareTo(amountRangeTo) <= 0; }
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user