formatting and cleaning up the entire project
This commit is contained in:
+10
-9
@@ -21,6 +21,7 @@ import org.mifosplatform.mix.data.NamespaceData;
|
||||
import org.mifosplatform.mix.service.NamespaceReadPlatformServiceImpl;
|
||||
import org.mifosplatform.mix.service.XBRLBuilder;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Matchers;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
@@ -33,13 +34,13 @@ public class XBRLBuilderTest {
|
||||
@Mock
|
||||
private NamespaceReadPlatformServiceImpl readNamespaceService;
|
||||
@InjectMocks
|
||||
private XBRLBuilder xbrlBuilder = new XBRLBuilder();
|
||||
private final XBRLBuilder xbrlBuilder = new XBRLBuilder();
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
||||
readNamespaceService = Mockito.mock(NamespaceReadPlatformServiceImpl.class);
|
||||
when(readNamespaceService.retrieveNamespaceByPrefix(Mockito.anyString())).thenReturn(
|
||||
this.readNamespaceService = Mockito.mock(NamespaceReadPlatformServiceImpl.class);
|
||||
when(this.readNamespaceService.retrieveNamespaceByPrefix(Matchers.anyString())).thenReturn(
|
||||
new NamespaceData(1l, "mockedprefix", "mockedurl"));
|
||||
|
||||
}
|
||||
@@ -47,23 +48,23 @@ public class XBRLBuilderTest {
|
||||
@Test
|
||||
public void shouldCorrectlyBuildMap() {
|
||||
|
||||
HashMap<MixTaxonomyData, BigDecimal> map = new HashMap<MixTaxonomyData, BigDecimal>();
|
||||
MixTaxonomyData data1 = Mockito.mock(MixTaxonomyData.class);
|
||||
final HashMap<MixTaxonomyData, BigDecimal> map = new HashMap<MixTaxonomyData, BigDecimal>();
|
||||
final MixTaxonomyData data1 = Mockito.mock(MixTaxonomyData.class);
|
||||
when(data1.getName()).thenReturn("Assets");
|
||||
map.put(data1, new BigDecimal(10000));
|
||||
String result = xbrlBuilder.build(map, Date.valueOf("2005-11-11"), Date.valueOf("2013-07-17"), "USD");
|
||||
final String result = this.xbrlBuilder.build(map, Date.valueOf("2005-11-11"), Date.valueOf("2013-07-17"), "USD");
|
||||
System.out.println(result);
|
||||
NodeList nodes = null;
|
||||
try {
|
||||
nodes = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(result.getBytes()))
|
||||
.getElementsByTagName("Assets");
|
||||
} catch (SAXException e) {
|
||||
} catch (final SAXException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (ParserConfigurationException e) {
|
||||
} catch (final ParserConfigurationException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
+184
-135
@@ -1,8 +1,5 @@
|
||||
package org.mifosplatform.portfolio.loanaccount;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
@@ -10,7 +7,6 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mifosplatform.organisation.monetary.domain.MonetaryCurrency;
|
||||
import org.mifosplatform.organisation.monetary.domain.Money;
|
||||
import org.mifosplatform.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment;
|
||||
import org.mifosplatform.portfolio.loanaccount.domain.transactionprocessor.impl.RBILoanRepaymentScheduleTransactionProcessor;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
@@ -18,136 +14,189 @@ import org.mockito.runners.MockitoJUnitRunner;
|
||||
@SuppressWarnings("unused")
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class AdhikarLoanRepaymentScheduleTransactionProcessorTest {
|
||||
|
||||
// class under test
|
||||
private RBILoanRepaymentScheduleTransactionProcessor processor;
|
||||
|
||||
//
|
||||
private LocalDate july2nd = new LocalDate(2012, 7, 2);
|
||||
private MonetaryCurrency usDollars = new MonetaryCurrencyBuilder().withCode("USD").withDigitsAfterDecimal(2).build();
|
||||
private List<LoanRepaymentScheduleInstallment> installments;
|
||||
|
||||
@Before
|
||||
public void setUpForEachTestCase() {
|
||||
|
||||
installments = LoanScheduleTestDataHelper.createSimpleLoanSchedule(july2nd, usDollars);
|
||||
|
||||
processor = new RBILoanRepaymentScheduleTransactionProcessor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 1: Given no overdue installments, current interest due is paid before principal.
|
||||
*/
|
||||
@Test
|
||||
public void givenNoOverdueInstallmentsOnTimeRepaymentPaysOffInterestDueFirst() {
|
||||
|
||||
// // setup
|
||||
// Money repaymentAmount = new MoneyBuilder().with(usDollars).with("100.00").build();
|
||||
// LoanTransaction onTimePartialRepayment = new LoanTransactionBuilder().repayment().with(july2nd).with(repaymentAmount).build();
|
||||
//
|
||||
// // execute test
|
||||
// processor.handleTransaction(onTimePartialRepayment, usDollars, installments);
|
||||
//
|
||||
// // verification of derived fields on installments
|
||||
// LoanRepaymentScheduleInstallment firstInstallment = this.installments.get(0);
|
||||
// assertThatLoanInstallmentHasDerivedFieldsOf(principalOf("0.00"), interestOf("100.00"), interestWaivedOf("0.00"), firstInstallment, usDollars);
|
||||
//
|
||||
// assertThatLoanTransactionHasDerivedFieldsOf(principalOf("0.00"), interestOf("100.00"), onTimePartialRepayment, usDollars);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Scenario 2: Given overdue interest exists on overdue installment, a late
|
||||
// * repayment results in overdue interest and current interest being paid
|
||||
// * before principal component for overdue or current installments.
|
||||
// */
|
||||
// @Test
|
||||
// public void givenOverdueInterestOnOverdueInstallmentsLateRepaymentPaysOffOverdueInterestAndCurrentInterestDue() {
|
||||
//
|
||||
// // setup
|
||||
// Money repaymentAmount = new MoneyBuilder().with(usDollars).with("300.00").build();
|
||||
// LoanTransaction lateRepayment = new LoanTransactionBuilder().repayment().with(july2nd.plusMonths(1)).with(repaymentAmount).build();
|
||||
//
|
||||
// // execute test
|
||||
// processor.handleTransaction(lateRepayment, usDollars, installments);
|
||||
//
|
||||
// // verification of derived fields on installments
|
||||
// LoanRepaymentScheduleInstallment firstInstallment = this.installments.get(0);
|
||||
// assertThatLoanInstallmentHasDerivedFieldsOf(principalOf("0.00"), interestOf("200.00"), interestWaivedOf("0.00"), firstInstallment, usDollars);
|
||||
//
|
||||
// LoanRepaymentScheduleInstallment secondInstallment = this.installments.get(1);
|
||||
// assertThatLoanInstallmentHasDerivedFieldsOf(principalOf("0.00"), interestOf("100.00"), interestWaivedOf("0.00"), secondInstallment, usDollars);
|
||||
//
|
||||
// LoanRepaymentScheduleInstallment thirdInstallment = this.installments.get(2);
|
||||
// assertThatLoanInstallmentHasDerivedFieldsOf(principalOf("0.00"), interestOf("0.00"), interestWaivedOf("0.00"), thirdInstallment, usDollars);
|
||||
//
|
||||
// assertThatLoanTransactionHasDerivedFieldsOf(principalOf("0.00"), interestOf("300.00"), lateRepayment, usDollars);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Scenario 3: Given an overdue installment with overdue interest and principal, a late
|
||||
// * repayment results in overdue interest and current interest being paid
|
||||
// * before principal component for overdue or current installments.
|
||||
// */
|
||||
// @Test
|
||||
// public void givenAFullyOverdueInstallmentALateRepaymentShouldPayOffOverdueInterestAndCurrentInterestDueFirstThenOverduePrincipal() {
|
||||
//
|
||||
// // setup
|
||||
// Money repaymentAmount = new MoneyBuilder().with(usDollars).with("900.00").build();
|
||||
// LoanTransaction lateRepayment = new LoanTransactionBuilder().repayment().with(july2nd.plusMonths(1)).with(repaymentAmount).build();
|
||||
//
|
||||
// // execute test
|
||||
// processor.handleTransaction(lateRepayment, usDollars, installments);
|
||||
//
|
||||
// // verification of derived fields on installments
|
||||
// LoanRepaymentScheduleInstallment firstInstallment = this.installments.get(0);
|
||||
// assertThatLoanInstallmentHasDerivedFieldsOf(principalOf("500.00"), interestOf("200.00"), interestWaivedOf("0.00"), firstInstallment, usDollars);
|
||||
//
|
||||
// LoanRepaymentScheduleInstallment secondInstallment = this.installments.get(1);
|
||||
// assertThatLoanInstallmentHasDerivedFieldsOf(principalOf("0.00"), interestOf("200.00"), interestWaivedOf("0.00"), secondInstallment, usDollars);
|
||||
//
|
||||
// LoanRepaymentScheduleInstallment thirdInstallment = this.installments.get(2);
|
||||
// assertThatLoanInstallmentHasDerivedFieldsOf(principalOf("0.00"), interestOf("0.00"), interestWaivedOf("0.00"), thirdInstallment, usDollars);
|
||||
//
|
||||
// assertThatLoanTransactionHasDerivedFieldsOf(principalOf("500.00"), interestOf("400.00"), lateRepayment, usDollars);
|
||||
// }
|
||||
//
|
||||
// private void assertThatLoanTransactionHasDerivedFieldsOf(
|
||||
// final String principal,
|
||||
// final String interest,
|
||||
// final LoanTransaction transaction, final MonetaryCurrency currency) {
|
||||
//
|
||||
// Money expectedPrincipalPortion = new MoneyBuilder().with(currency).with(principal).build();
|
||||
// assertThat("Principal portion of transaction not as expected: ", transaction.getPrincipalPortion(currency).toString(), is(expectedPrincipalPortion.toString()));
|
||||
//
|
||||
// Money expectedInterestPortion = new MoneyBuilder().with(currency).with(interest).build();
|
||||
// assertThat("Interest portion of transaction not as expected: ", transaction.getInterestPortion(currency).toString(), is(expectedInterestPortion.toString()));
|
||||
// }
|
||||
//
|
||||
// private void assertThatLoanInstallmentHasDerivedFieldsOf(
|
||||
// final String principal,
|
||||
// final String interest,
|
||||
// final String interestWaived,
|
||||
// final LoanRepaymentScheduleInstallment installment, final MonetaryCurrency currency) {
|
||||
//
|
||||
// Money expectedPrincipalCompleted = new MoneyBuilder().with(currency).with(principal).build();
|
||||
// assertThat("principal not as expected", installment.getPrincipalCompleted(currency).toString(), is(expectedPrincipalCompleted.toString()));
|
||||
//
|
||||
// Money expectedInterestCompleted = new MoneyBuilder().with(currency).with(interest).build();
|
||||
// assertThat("interest completed not as expected: ",installment.getInterestCompleted(currency).toString(), is(expectedInterestCompleted.toString()));
|
||||
//
|
||||
// Money expectedInterestWaived = new MoneyBuilder().with(currency).with(interestWaived).build();
|
||||
// assertThat("interest waived not as expected: ", installment.getInterestWaived(currency).toString(), is(expectedInterestWaived.toString()));
|
||||
// }
|
||||
//
|
||||
// private String principalOf(final String value) {
|
||||
// return value;
|
||||
// }
|
||||
//
|
||||
// private String interestOf(final String value) {
|
||||
// return value;
|
||||
// }
|
||||
//
|
||||
// private String interestWaivedOf(final String value) {
|
||||
// return value;
|
||||
// }
|
||||
// class under test
|
||||
private RBILoanRepaymentScheduleTransactionProcessor processor;
|
||||
|
||||
//
|
||||
private final LocalDate july2nd = new LocalDate(2012, 7, 2);
|
||||
private final MonetaryCurrency usDollars = new MonetaryCurrencyBuilder().withCode("USD").withDigitsAfterDecimal(2).build();
|
||||
private List<LoanRepaymentScheduleInstallment> installments;
|
||||
|
||||
@Before
|
||||
public void setUpForEachTestCase() {
|
||||
|
||||
this.installments = LoanScheduleTestDataHelper.createSimpleLoanSchedule(this.july2nd, this.usDollars);
|
||||
|
||||
this.processor = new RBILoanRepaymentScheduleTransactionProcessor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenario 1: Given no overdue installments, current interest due is paid
|
||||
* before principal.
|
||||
*/
|
||||
@Test
|
||||
public void givenNoOverdueInstallmentsOnTimeRepaymentPaysOffInterestDueFirst() {
|
||||
|
||||
// // setup
|
||||
// Money repaymentAmount = new
|
||||
// MoneyBuilder().with(usDollars).with("100.00").build();
|
||||
// LoanTransaction onTimePartialRepayment = new
|
||||
// LoanTransactionBuilder().repayment().with(july2nd).with(repaymentAmount).build();
|
||||
//
|
||||
// // execute test
|
||||
// processor.handleTransaction(onTimePartialRepayment, usDollars,
|
||||
// installments);
|
||||
//
|
||||
// // verification of derived fields on installments
|
||||
// LoanRepaymentScheduleInstallment firstInstallment =
|
||||
// this.installments.get(0);
|
||||
// assertThatLoanInstallmentHasDerivedFieldsOf(principalOf("0.00"),
|
||||
// interestOf("100.00"), interestWaivedOf("0.00"), firstInstallment,
|
||||
// usDollars);
|
||||
//
|
||||
// assertThatLoanTransactionHasDerivedFieldsOf(principalOf("0.00"),
|
||||
// interestOf("100.00"), onTimePartialRepayment, usDollars);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Scenario 2: Given overdue interest exists on overdue installment, a
|
||||
// late
|
||||
// * repayment results in overdue interest and current interest being paid
|
||||
// * before principal component for overdue or current installments.
|
||||
// */
|
||||
// @Test
|
||||
// public void
|
||||
// givenOverdueInterestOnOverdueInstallmentsLateRepaymentPaysOffOverdueInterestAndCurrentInterestDue()
|
||||
// {
|
||||
//
|
||||
// // setup
|
||||
// Money repaymentAmount = new
|
||||
// MoneyBuilder().with(usDollars).with("300.00").build();
|
||||
// LoanTransaction lateRepayment = new
|
||||
// LoanTransactionBuilder().repayment().with(july2nd.plusMonths(1)).with(repaymentAmount).build();
|
||||
//
|
||||
// // execute test
|
||||
// processor.handleTransaction(lateRepayment, usDollars, installments);
|
||||
//
|
||||
// // verification of derived fields on installments
|
||||
// LoanRepaymentScheduleInstallment firstInstallment =
|
||||
// this.installments.get(0);
|
||||
// assertThatLoanInstallmentHasDerivedFieldsOf(principalOf("0.00"),
|
||||
// interestOf("200.00"), interestWaivedOf("0.00"), firstInstallment,
|
||||
// usDollars);
|
||||
//
|
||||
// LoanRepaymentScheduleInstallment secondInstallment =
|
||||
// this.installments.get(1);
|
||||
// assertThatLoanInstallmentHasDerivedFieldsOf(principalOf("0.00"),
|
||||
// interestOf("100.00"), interestWaivedOf("0.00"), secondInstallment,
|
||||
// usDollars);
|
||||
//
|
||||
// LoanRepaymentScheduleInstallment thirdInstallment =
|
||||
// this.installments.get(2);
|
||||
// assertThatLoanInstallmentHasDerivedFieldsOf(principalOf("0.00"),
|
||||
// interestOf("0.00"), interestWaivedOf("0.00"), thirdInstallment,
|
||||
// usDollars);
|
||||
//
|
||||
// assertThatLoanTransactionHasDerivedFieldsOf(principalOf("0.00"),
|
||||
// interestOf("300.00"), lateRepayment, usDollars);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Scenario 3: Given an overdue installment with overdue interest and
|
||||
// principal, a late
|
||||
// * repayment results in overdue interest and current interest being paid
|
||||
// * before principal component for overdue or current installments.
|
||||
// */
|
||||
// @Test
|
||||
// public void
|
||||
// givenAFullyOverdueInstallmentALateRepaymentShouldPayOffOverdueInterestAndCurrentInterestDueFirstThenOverduePrincipal()
|
||||
// {
|
||||
//
|
||||
// // setup
|
||||
// Money repaymentAmount = new
|
||||
// MoneyBuilder().with(usDollars).with("900.00").build();
|
||||
// LoanTransaction lateRepayment = new
|
||||
// LoanTransactionBuilder().repayment().with(july2nd.plusMonths(1)).with(repaymentAmount).build();
|
||||
//
|
||||
// // execute test
|
||||
// processor.handleTransaction(lateRepayment, usDollars, installments);
|
||||
//
|
||||
// // verification of derived fields on installments
|
||||
// LoanRepaymentScheduleInstallment firstInstallment =
|
||||
// this.installments.get(0);
|
||||
// assertThatLoanInstallmentHasDerivedFieldsOf(principalOf("500.00"),
|
||||
// interestOf("200.00"), interestWaivedOf("0.00"), firstInstallment,
|
||||
// usDollars);
|
||||
//
|
||||
// LoanRepaymentScheduleInstallment secondInstallment =
|
||||
// this.installments.get(1);
|
||||
// assertThatLoanInstallmentHasDerivedFieldsOf(principalOf("0.00"),
|
||||
// interestOf("200.00"), interestWaivedOf("0.00"), secondInstallment,
|
||||
// usDollars);
|
||||
//
|
||||
// LoanRepaymentScheduleInstallment thirdInstallment =
|
||||
// this.installments.get(2);
|
||||
// assertThatLoanInstallmentHasDerivedFieldsOf(principalOf("0.00"),
|
||||
// interestOf("0.00"), interestWaivedOf("0.00"), thirdInstallment,
|
||||
// usDollars);
|
||||
//
|
||||
// assertThatLoanTransactionHasDerivedFieldsOf(principalOf("500.00"),
|
||||
// interestOf("400.00"), lateRepayment, usDollars);
|
||||
// }
|
||||
//
|
||||
// private void assertThatLoanTransactionHasDerivedFieldsOf(
|
||||
// final String principal,
|
||||
// final String interest,
|
||||
// final LoanTransaction transaction, final MonetaryCurrency currency) {
|
||||
//
|
||||
// Money expectedPrincipalPortion = new
|
||||
// MoneyBuilder().with(currency).with(principal).build();
|
||||
// assertThat("Principal portion of transaction not as expected: ",
|
||||
// transaction.getPrincipalPortion(currency).toString(),
|
||||
// is(expectedPrincipalPortion.toString()));
|
||||
//
|
||||
// Money expectedInterestPortion = new
|
||||
// MoneyBuilder().with(currency).with(interest).build();
|
||||
// assertThat("Interest portion of transaction not as expected: ",
|
||||
// transaction.getInterestPortion(currency).toString(),
|
||||
// is(expectedInterestPortion.toString()));
|
||||
// }
|
||||
//
|
||||
// private void assertThatLoanInstallmentHasDerivedFieldsOf(
|
||||
// final String principal,
|
||||
// final String interest,
|
||||
// final String interestWaived,
|
||||
// final LoanRepaymentScheduleInstallment installment, final
|
||||
// MonetaryCurrency currency) {
|
||||
//
|
||||
// Money expectedPrincipalCompleted = new
|
||||
// MoneyBuilder().with(currency).with(principal).build();
|
||||
// assertThat("principal not as expected",
|
||||
// installment.getPrincipalCompleted(currency).toString(),
|
||||
// is(expectedPrincipalCompleted.toString()));
|
||||
//
|
||||
// Money expectedInterestCompleted = new
|
||||
// MoneyBuilder().with(currency).with(interest).build();
|
||||
// assertThat("interest completed not as expected: ",installment.getInterestCompleted(currency).toString(),
|
||||
// is(expectedInterestCompleted.toString()));
|
||||
//
|
||||
// Money expectedInterestWaived = new
|
||||
// MoneyBuilder().with(currency).with(interestWaived).build();
|
||||
// assertThat("interest waived not as expected: ",
|
||||
// installment.getInterestWaived(currency).toString(),
|
||||
// is(expectedInterestWaived.toString()));
|
||||
// }
|
||||
//
|
||||
// private String principalOf(final String value) {
|
||||
// return value;
|
||||
// }
|
||||
//
|
||||
// private String interestOf(final String value) {
|
||||
// return value;
|
||||
// }
|
||||
//
|
||||
// private String interestWaivedOf(final String value) {
|
||||
// return value;
|
||||
// }
|
||||
}
|
||||
+4
-8
@@ -1,8 +1,5 @@
|
||||
package org.mifosplatform.portfolio.loanaccount;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
@@ -10,7 +7,6 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mifosplatform.organisation.monetary.domain.MonetaryCurrency;
|
||||
import org.mifosplatform.organisation.monetary.domain.Money;
|
||||
import org.mifosplatform.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment;
|
||||
import org.mifosplatform.portfolio.loanaccount.domain.transactionprocessor.impl.HeavensFamilyLoanRepaymentScheduleTransactionProcessor;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
@@ -23,16 +19,16 @@ public class HeavensFamilyLoanRepaymentScheduleTransactionProcessorTest {
|
||||
private HeavensFamilyLoanRepaymentScheduleTransactionProcessor processor;
|
||||
|
||||
//
|
||||
private LocalDate july2nd = new LocalDate(2012, 7, 2);
|
||||
private MonetaryCurrency usDollars = new MonetaryCurrencyBuilder().withCode("USD").withDigitsAfterDecimal(2).build();
|
||||
private final LocalDate july2nd = new LocalDate(2012, 7, 2);
|
||||
private final MonetaryCurrency usDollars = new MonetaryCurrencyBuilder().withCode("USD").withDigitsAfterDecimal(2).build();
|
||||
private List<LoanRepaymentScheduleInstallment> installments;
|
||||
|
||||
@Before
|
||||
public void setUpForEachTestCase() {
|
||||
|
||||
installments = LoanScheduleTestDataHelper.createSimpleLoanSchedule(july2nd, usDollars);
|
||||
this.installments = LoanScheduleTestDataHelper.createSimpleLoanSchedule(this.july2nd, this.usDollars);
|
||||
|
||||
processor = new HeavensFamilyLoanRepaymentScheduleTransactionProcessor();
|
||||
this.processor = new HeavensFamilyLoanRepaymentScheduleTransactionProcessor();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+53
-53
@@ -19,23 +19,23 @@ public class LoanProductRelatedDetailTestHelper {
|
||||
|
||||
public static LoanProductRelatedDetail createSettingsForEqualPrincipalAmortizationQuarterly() {
|
||||
|
||||
MonetaryCurrency currency = new MonetaryCurrencyBuilder().withCode("USD").withDigitsAfterDecimal(2).build();
|
||||
BigDecimal defaultPrincipal = BigDecimal.valueOf(Double.valueOf("200000"));
|
||||
final MonetaryCurrency currency = new MonetaryCurrencyBuilder().withCode("USD").withDigitsAfterDecimal(2).build();
|
||||
final BigDecimal defaultPrincipal = BigDecimal.valueOf(Double.valueOf("200000"));
|
||||
|
||||
// 2% per month, 24% per year
|
||||
BigDecimal defaultNominalInterestRatePerPeriod = BigDecimal.valueOf(Double.valueOf("2"));
|
||||
PeriodFrequencyType interestPeriodFrequencyType = PeriodFrequencyType.MONTHS;
|
||||
BigDecimal defaultAnnualNominalInterestRate = BigDecimal.valueOf(Double.valueOf("24"));
|
||||
final BigDecimal defaultNominalInterestRatePerPeriod = BigDecimal.valueOf(Double.valueOf("2"));
|
||||
final PeriodFrequencyType interestPeriodFrequencyType = PeriodFrequencyType.MONTHS;
|
||||
final BigDecimal defaultAnnualNominalInterestRate = BigDecimal.valueOf(Double.valueOf("24"));
|
||||
|
||||
InterestMethod interestMethod = InterestMethod.DECLINING_BALANCE;
|
||||
InterestCalculationPeriodMethod interestCalculationPeriodMethod = InterestCalculationPeriodMethod.SAME_AS_REPAYMENT_PERIOD;
|
||||
Integer repayEvery = Integer.valueOf(3);
|
||||
PeriodFrequencyType repaymentFrequencyType = PeriodFrequencyType.MONTHS;
|
||||
final InterestMethod interestMethod = InterestMethod.DECLINING_BALANCE;
|
||||
final InterestCalculationPeriodMethod interestCalculationPeriodMethod = InterestCalculationPeriodMethod.SAME_AS_REPAYMENT_PERIOD;
|
||||
final Integer repayEvery = Integer.valueOf(3);
|
||||
final PeriodFrequencyType repaymentFrequencyType = PeriodFrequencyType.MONTHS;
|
||||
|
||||
Integer defaultNumberOfRepayments = Integer.valueOf(4);
|
||||
AmortizationMethod amortizationMethod = AmortizationMethod.EQUAL_PRINCIPAL;
|
||||
final Integer defaultNumberOfRepayments = Integer.valueOf(4);
|
||||
final AmortizationMethod amortizationMethod = AmortizationMethod.EQUAL_PRINCIPAL;
|
||||
|
||||
BigDecimal inArrearsTolerance = BigDecimal.ZERO;
|
||||
final BigDecimal inArrearsTolerance = BigDecimal.ZERO;
|
||||
|
||||
return createLoanProductRelatedDetail(currency, defaultPrincipal, defaultNominalInterestRatePerPeriod, interestPeriodFrequencyType,
|
||||
defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod, repayEvery, repaymentFrequencyType,
|
||||
@@ -43,23 +43,23 @@ public class LoanProductRelatedDetailTestHelper {
|
||||
}
|
||||
|
||||
public static LoanProductRelatedDetail createSettingsForEqualInstallmentAmortizationQuarterly() {
|
||||
MonetaryCurrency currency = new MonetaryCurrencyBuilder().withCode("USD").withDigitsAfterDecimal(2).build();
|
||||
BigDecimal defaultPrincipal = BigDecimal.valueOf(Double.valueOf("200000"));
|
||||
final MonetaryCurrency currency = new MonetaryCurrencyBuilder().withCode("USD").withDigitsAfterDecimal(2).build();
|
||||
final BigDecimal defaultPrincipal = BigDecimal.valueOf(Double.valueOf("200000"));
|
||||
|
||||
// 2% per month, 24% per year
|
||||
BigDecimal defaultNominalInterestRatePerPeriod = BigDecimal.valueOf(Double.valueOf("2"));
|
||||
PeriodFrequencyType interestPeriodFrequencyType = PeriodFrequencyType.MONTHS;
|
||||
BigDecimal defaultAnnualNominalInterestRate = BigDecimal.valueOf(Double.valueOf("24"));
|
||||
final BigDecimal defaultNominalInterestRatePerPeriod = BigDecimal.valueOf(Double.valueOf("2"));
|
||||
final PeriodFrequencyType interestPeriodFrequencyType = PeriodFrequencyType.MONTHS;
|
||||
final BigDecimal defaultAnnualNominalInterestRate = BigDecimal.valueOf(Double.valueOf("24"));
|
||||
|
||||
InterestMethod interestMethod = InterestMethod.DECLINING_BALANCE;
|
||||
InterestCalculationPeriodMethod interestCalculationPeriodMethod = InterestCalculationPeriodMethod.SAME_AS_REPAYMENT_PERIOD;
|
||||
Integer repayEvery = Integer.valueOf(3);
|
||||
PeriodFrequencyType repaymentFrequencyType = PeriodFrequencyType.MONTHS;
|
||||
final InterestMethod interestMethod = InterestMethod.DECLINING_BALANCE;
|
||||
final InterestCalculationPeriodMethod interestCalculationPeriodMethod = InterestCalculationPeriodMethod.SAME_AS_REPAYMENT_PERIOD;
|
||||
final Integer repayEvery = Integer.valueOf(3);
|
||||
final PeriodFrequencyType repaymentFrequencyType = PeriodFrequencyType.MONTHS;
|
||||
|
||||
Integer defaultNumberOfRepayments = Integer.valueOf(4);
|
||||
AmortizationMethod amortizationMethod = AmortizationMethod.EQUAL_INSTALLMENTS;
|
||||
final Integer defaultNumberOfRepayments = Integer.valueOf(4);
|
||||
final AmortizationMethod amortizationMethod = AmortizationMethod.EQUAL_INSTALLMENTS;
|
||||
|
||||
BigDecimal inArrearsTolerance = BigDecimal.ZERO;
|
||||
final BigDecimal inArrearsTolerance = BigDecimal.ZERO;
|
||||
|
||||
return createLoanProductRelatedDetail(currency, defaultPrincipal, defaultNominalInterestRatePerPeriod, interestPeriodFrequencyType,
|
||||
defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod, repayEvery, repaymentFrequencyType,
|
||||
@@ -68,22 +68,22 @@ public class LoanProductRelatedDetailTestHelper {
|
||||
|
||||
public static LoanProductRelatedDetail createSettingsForFlatQuarterly(final AmortizationMethod amortizationMethod) {
|
||||
|
||||
MonetaryCurrency currency = new MonetaryCurrencyBuilder().withCode("USD").withDigitsAfterDecimal(2).build();
|
||||
BigDecimal defaultPrincipal = BigDecimal.valueOf(Double.valueOf("200000"));
|
||||
final MonetaryCurrency currency = new MonetaryCurrencyBuilder().withCode("USD").withDigitsAfterDecimal(2).build();
|
||||
final BigDecimal defaultPrincipal = BigDecimal.valueOf(Double.valueOf("200000"));
|
||||
|
||||
// 2% per month, 24% per year
|
||||
BigDecimal defaultNominalInterestRatePerPeriod = BigDecimal.valueOf(Double.valueOf("2"));
|
||||
PeriodFrequencyType interestPeriodFrequencyType = PeriodFrequencyType.MONTHS;
|
||||
BigDecimal defaultAnnualNominalInterestRate = BigDecimal.valueOf(Double.valueOf("24"));
|
||||
final BigDecimal defaultNominalInterestRatePerPeriod = BigDecimal.valueOf(Double.valueOf("2"));
|
||||
final PeriodFrequencyType interestPeriodFrequencyType = PeriodFrequencyType.MONTHS;
|
||||
final BigDecimal defaultAnnualNominalInterestRate = BigDecimal.valueOf(Double.valueOf("24"));
|
||||
|
||||
InterestMethod interestMethod = InterestMethod.FLAT;
|
||||
InterestCalculationPeriodMethod interestCalculationPeriodMethod = InterestCalculationPeriodMethod.SAME_AS_REPAYMENT_PERIOD;
|
||||
Integer repayEvery = Integer.valueOf(3);
|
||||
PeriodFrequencyType repaymentFrequencyType = PeriodFrequencyType.MONTHS;
|
||||
final InterestMethod interestMethod = InterestMethod.FLAT;
|
||||
final InterestCalculationPeriodMethod interestCalculationPeriodMethod = InterestCalculationPeriodMethod.SAME_AS_REPAYMENT_PERIOD;
|
||||
final Integer repayEvery = Integer.valueOf(3);
|
||||
final PeriodFrequencyType repaymentFrequencyType = PeriodFrequencyType.MONTHS;
|
||||
|
||||
Integer defaultNumberOfRepayments = Integer.valueOf(4);
|
||||
final Integer defaultNumberOfRepayments = Integer.valueOf(4);
|
||||
|
||||
BigDecimal inArrearsTolerance = BigDecimal.ZERO;
|
||||
final BigDecimal inArrearsTolerance = BigDecimal.ZERO;
|
||||
|
||||
return createLoanProductRelatedDetail(currency, defaultPrincipal, defaultNominalInterestRatePerPeriod, interestPeriodFrequencyType,
|
||||
defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod, repayEvery, repaymentFrequencyType,
|
||||
@@ -92,36 +92,36 @@ public class LoanProductRelatedDetailTestHelper {
|
||||
|
||||
public static LoanProductRelatedDetail createSettingsForIrregularFlatEveryFourMonths() {
|
||||
|
||||
MonetaryCurrency currency = new MonetaryCurrencyBuilder().withCode("KSH").withDigitsAfterDecimal(0).build();
|
||||
BigDecimal defaultPrincipal = BigDecimal.valueOf(Double.valueOf("15000"));
|
||||
final MonetaryCurrency currency = new MonetaryCurrencyBuilder().withCode("KSH").withDigitsAfterDecimal(0).build();
|
||||
final BigDecimal defaultPrincipal = BigDecimal.valueOf(Double.valueOf("15000"));
|
||||
|
||||
// 2% per month, 24% per year
|
||||
BigDecimal defaultNominalInterestRatePerPeriod = BigDecimal.valueOf(Double.valueOf("2"));
|
||||
PeriodFrequencyType interestPeriodFrequencyType = PeriodFrequencyType.MONTHS;
|
||||
BigDecimal defaultAnnualNominalInterestRate = BigDecimal.valueOf(Double.valueOf("24"));
|
||||
final BigDecimal defaultNominalInterestRatePerPeriod = BigDecimal.valueOf(Double.valueOf("2"));
|
||||
final PeriodFrequencyType interestPeriodFrequencyType = PeriodFrequencyType.MONTHS;
|
||||
final BigDecimal defaultAnnualNominalInterestRate = BigDecimal.valueOf(Double.valueOf("24"));
|
||||
|
||||
InterestMethod interestMethod = InterestMethod.FLAT;
|
||||
InterestCalculationPeriodMethod interestCalculationPeriodMethod = InterestCalculationPeriodMethod.SAME_AS_REPAYMENT_PERIOD;
|
||||
Integer repayEvery = Integer.valueOf(3);
|
||||
PeriodFrequencyType repaymentFrequencyType = PeriodFrequencyType.MONTHS;
|
||||
final InterestMethod interestMethod = InterestMethod.FLAT;
|
||||
final InterestCalculationPeriodMethod interestCalculationPeriodMethod = InterestCalculationPeriodMethod.SAME_AS_REPAYMENT_PERIOD;
|
||||
final Integer repayEvery = Integer.valueOf(3);
|
||||
final PeriodFrequencyType repaymentFrequencyType = PeriodFrequencyType.MONTHS;
|
||||
|
||||
Integer defaultNumberOfRepayments = Integer.valueOf(2);
|
||||
final Integer defaultNumberOfRepayments = Integer.valueOf(2);
|
||||
|
||||
BigDecimal inArrearsTolerance = BigDecimal.ZERO;
|
||||
final BigDecimal inArrearsTolerance = BigDecimal.ZERO;
|
||||
|
||||
AmortizationMethod amortizationMethod = AmortizationMethod.EQUAL_PRINCIPAL;
|
||||
final AmortizationMethod amortizationMethod = AmortizationMethod.EQUAL_PRINCIPAL;
|
||||
|
||||
return createLoanProductRelatedDetail(currency, defaultPrincipal, defaultNominalInterestRatePerPeriod, interestPeriodFrequencyType,
|
||||
defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod, repayEvery, repaymentFrequencyType,
|
||||
defaultNumberOfRepayments, amortizationMethod, inArrearsTolerance);
|
||||
}
|
||||
|
||||
private static LoanProductRelatedDetail createLoanProductRelatedDetail(final MonetaryCurrency currency, final BigDecimal defaultPrincipal,
|
||||
final BigDecimal defaultNominalInterestRatePerPeriod, final PeriodFrequencyType interestPeriodFrequencyType,
|
||||
final BigDecimal defaultAnnualNominalInterestRate, final InterestMethod interestMethod,
|
||||
final InterestCalculationPeriodMethod interestCalculationPeriodMethod, final Integer repayEvery,
|
||||
final PeriodFrequencyType repaymentFrequencyType, final Integer defaultNumberOfRepayments, final AmortizationMethod amortizationMethod,
|
||||
final BigDecimal inArrearsTolerance) {
|
||||
private static LoanProductRelatedDetail createLoanProductRelatedDetail(final MonetaryCurrency currency,
|
||||
final BigDecimal defaultPrincipal, final BigDecimal defaultNominalInterestRatePerPeriod,
|
||||
final PeriodFrequencyType interestPeriodFrequencyType, final BigDecimal defaultAnnualNominalInterestRate,
|
||||
final InterestMethod interestMethod, final InterestCalculationPeriodMethod interestCalculationPeriodMethod,
|
||||
final Integer repayEvery, final PeriodFrequencyType repaymentFrequencyType, final Integer defaultNumberOfRepayments,
|
||||
final AmortizationMethod amortizationMethod, final BigDecimal inArrearsTolerance) {
|
||||
|
||||
final Integer graceOnPrincipalPayment = Integer.valueOf(0);
|
||||
final Integer graceOnInterestPayment = Integer.valueOf(0);
|
||||
|
||||
+8
-7
@@ -27,22 +27,23 @@ public class LoanRepaymentScheduleInstallmentBuilder {
|
||||
}
|
||||
|
||||
public LoanRepaymentScheduleInstallment build() {
|
||||
LoanRepaymentScheduleInstallment installment = new LoanRepaymentScheduleInstallment(loan, installmentNumber, fromDate, dueDate,
|
||||
principal.getAmount(), interest.getAmount(), feeCharges.getAmount(), penaltyCharges.getAmount());
|
||||
if (completed) {
|
||||
installment.payPrincipalComponent(latestTransactionDate, principal);
|
||||
installment.payInterestComponent(latestTransactionDate, interest);
|
||||
final LoanRepaymentScheduleInstallment installment = new LoanRepaymentScheduleInstallment(this.loan, this.installmentNumber,
|
||||
this.fromDate, this.dueDate, this.principal.getAmount(), this.interest.getAmount(), this.feeCharges.getAmount(),
|
||||
this.penaltyCharges.getAmount());
|
||||
if (this.completed) {
|
||||
installment.payPrincipalComponent(this.latestTransactionDate, this.principal);
|
||||
installment.payInterestComponent(this.latestTransactionDate, this.interest);
|
||||
}
|
||||
return installment;
|
||||
}
|
||||
|
||||
public LoanRepaymentScheduleInstallmentBuilder withPrincipal(final String withPrincipal) {
|
||||
this.principal = new MoneyBuilder().with(currencyDetail).with(withPrincipal).build();
|
||||
this.principal = new MoneyBuilder().with(this.currencyDetail).with(withPrincipal).build();
|
||||
return this;
|
||||
}
|
||||
|
||||
public LoanRepaymentScheduleInstallmentBuilder withInterest(final String withInterest) {
|
||||
this.interest = new MoneyBuilder().with(currencyDetail).with(withInterest).build();
|
||||
this.interest = new MoneyBuilder().with(this.currencyDetail).with(withInterest).build();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
+47
-73
@@ -12,81 +12,55 @@ import org.mifosplatform.portfolio.loanaccount.domain.LoanRepaymentScheduleInsta
|
||||
*/
|
||||
public class LoanScheduleTestDataHelper {
|
||||
|
||||
/**
|
||||
* Creates brand new three installment loan:
|
||||
*
|
||||
* For example:
|
||||
* with firstDueDate = 02 July 2011
|
||||
*
|
||||
* Date Principal Interest Interest Waived
|
||||
* ==================================================================================
|
||||
* 02 July 2011 1,000 200 0
|
||||
* 02 August 2011 1,000 200 0
|
||||
* 02 September 2011 1,000 200 0
|
||||
*/
|
||||
public static List<LoanRepaymentScheduleInstallment> createSimpleLoanSchedule(final LocalDate firstDueDate, final MonetaryCurrency currency) {
|
||||
LoanRepaymentScheduleInstallment firstInstallment = new LoanRepaymentScheduleInstallmentBuilder(currency)
|
||||
.withInstallmentNumber(1)
|
||||
.withDueDate(firstDueDate)
|
||||
.withPrincipal("1000.00")
|
||||
.withInterest("200.00")
|
||||
.build();
|
||||
/**
|
||||
* Creates brand new three installment loan:
|
||||
*
|
||||
* For example: with firstDueDate = 02 July 2011
|
||||
*
|
||||
* Date Principal Interest Interest Waived
|
||||
* ==================================
|
||||
* ================================================ 02 July 2011 1,000 200 0
|
||||
* 02 August 2011 1,000 200 0 02 September 2011 1,000 200 0
|
||||
*/
|
||||
public static List<LoanRepaymentScheduleInstallment> createSimpleLoanSchedule(final LocalDate firstDueDate,
|
||||
final MonetaryCurrency currency) {
|
||||
final LoanRepaymentScheduleInstallment firstInstallment = new LoanRepaymentScheduleInstallmentBuilder(currency)
|
||||
.withInstallmentNumber(1).withDueDate(firstDueDate).withPrincipal("1000.00").withInterest("200.00").build();
|
||||
|
||||
LoanRepaymentScheduleInstallment secondInstallment = new LoanRepaymentScheduleInstallmentBuilder(currency)
|
||||
.withInstallmentNumber(2)
|
||||
.withDueDate(firstDueDate.plusMonths(1))
|
||||
.withPrincipal("1000.00")
|
||||
.withInterest("200.00")
|
||||
.build();
|
||||
|
||||
LoanRepaymentScheduleInstallment thirdInstallment = new LoanRepaymentScheduleInstallmentBuilder(currency)
|
||||
.withInstallmentNumber(3)
|
||||
.withDueDate(firstDueDate.plusMonths(2))
|
||||
.withPrincipal("1000.00")
|
||||
.withInterest("200.00")
|
||||
.build();
|
||||
|
||||
return Arrays.asList(firstInstallment, secondInstallment, thirdInstallment);
|
||||
}
|
||||
final LoanRepaymentScheduleInstallment secondInstallment = new LoanRepaymentScheduleInstallmentBuilder(currency)
|
||||
.withInstallmentNumber(2).withDueDate(firstDueDate.plusMonths(1)).withPrincipal("1000.00").withInterest("200.00").build();
|
||||
|
||||
|
||||
/**
|
||||
* Creates three installment loan with first installment fully completed:
|
||||
*
|
||||
* For example:
|
||||
* with firstDueDate = 02 July 2011
|
||||
*
|
||||
* Date Principal Interest Interest Waived Completed
|
||||
* ================================================================================================================
|
||||
* 02 July 2011 1,000 200 0 true (principal paid, interest paid)
|
||||
* 02 August 2011 1,000 200 0 false
|
||||
* 02 September 2011 1,000 200 0 false
|
||||
*/
|
||||
public static List<LoanRepaymentScheduleInstallment> createSimpleLoanScheduleWithFirstInstallmentFullyPaid(final LocalDate firstDueDate, final MonetaryCurrency currency) {
|
||||
|
||||
LoanRepaymentScheduleInstallment firstInstallment = new LoanRepaymentScheduleInstallmentBuilder(currency)
|
||||
.withInstallmentNumber(1)
|
||||
.withDueDate(firstDueDate)
|
||||
.withPrincipal("1000.00")
|
||||
.withInterest("200.00")
|
||||
.completed()
|
||||
.build();
|
||||
final LoanRepaymentScheduleInstallment thirdInstallment = new LoanRepaymentScheduleInstallmentBuilder(currency)
|
||||
.withInstallmentNumber(3).withDueDate(firstDueDate.plusMonths(2)).withPrincipal("1000.00").withInterest("200.00").build();
|
||||
|
||||
LoanRepaymentScheduleInstallment secondInstallment = new LoanRepaymentScheduleInstallmentBuilder(currency)
|
||||
.withInstallmentNumber(2)
|
||||
.withDueDate(firstDueDate.plusMonths(1))
|
||||
.withPrincipal("1000.00")
|
||||
.withInterest("200.00")
|
||||
.build();
|
||||
|
||||
LoanRepaymentScheduleInstallment thirdInstallment = new LoanRepaymentScheduleInstallmentBuilder(currency)
|
||||
.withInstallmentNumber(3)
|
||||
.withDueDate(firstDueDate.plusMonths(2))
|
||||
.withPrincipal("1000.00")
|
||||
.withInterest("200.00")
|
||||
.build();
|
||||
|
||||
return Arrays.asList(firstInstallment, secondInstallment, thirdInstallment);
|
||||
}
|
||||
return Arrays.asList(firstInstallment, secondInstallment, thirdInstallment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates three installment loan with first installment fully completed:
|
||||
*
|
||||
* For example: with firstDueDate = 02 July 2011
|
||||
*
|
||||
* Date Principal Interest Interest Waived Completed
|
||||
* ========================
|
||||
* ==================================================
|
||||
* ====================================== 02 July 2011 1,000 200 0 true
|
||||
* (principal paid, interest paid) 02 August 2011 1,000 200 0 false 02
|
||||
* September 2011 1,000 200 0 false
|
||||
*/
|
||||
public static List<LoanRepaymentScheduleInstallment> createSimpleLoanScheduleWithFirstInstallmentFullyPaid(
|
||||
final LocalDate firstDueDate, final MonetaryCurrency currency) {
|
||||
|
||||
final LoanRepaymentScheduleInstallment firstInstallment = new LoanRepaymentScheduleInstallmentBuilder(currency)
|
||||
.withInstallmentNumber(1).withDueDate(firstDueDate).withPrincipal("1000.00").withInterest("200.00").completed().build();
|
||||
|
||||
final LoanRepaymentScheduleInstallment secondInstallment = new LoanRepaymentScheduleInstallmentBuilder(currency)
|
||||
.withInstallmentNumber(2).withDueDate(firstDueDate.plusMonths(1)).withPrincipal("1000.00").withInterest("200.00").build();
|
||||
|
||||
final LoanRepaymentScheduleInstallment thirdInstallment = new LoanRepaymentScheduleInstallmentBuilder(currency)
|
||||
.withInstallmentNumber(3).withDueDate(firstDueDate.plusMonths(2)).withPrincipal("1000.00").withInterest("200.00").build();
|
||||
|
||||
return Arrays.asList(firstInstallment, secondInstallment, thirdInstallment);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+10
-10
@@ -12,16 +12,16 @@ public class LoanTransactionBuilder {
|
||||
@SuppressWarnings("unused")
|
||||
private boolean repayment = false;
|
||||
|
||||
/** public LoanTransaction build() {
|
||||
|
||||
LoanTransaction transaction = null;
|
||||
|
||||
if (repayment) {
|
||||
transaction = LoanTransaction.repayment(transactionAmount, transactionDate);
|
||||
}
|
||||
|
||||
return transaction;
|
||||
}**/
|
||||
/**
|
||||
* public LoanTransaction build() {
|
||||
*
|
||||
* LoanTransaction transaction = null;
|
||||
*
|
||||
* if (repayment) { transaction =
|
||||
* LoanTransaction.repayment(transactionAmount, transactionDate); }
|
||||
*
|
||||
* return transaction; }
|
||||
**/
|
||||
|
||||
public LoanTransactionBuilder with(final Money newAmount) {
|
||||
this.transactionAmount = newAmount;
|
||||
|
||||
+2
-2
@@ -6,10 +6,10 @@ public class MonetaryCurrencyBuilder {
|
||||
|
||||
private String code = "XOF";
|
||||
private int digitsAfterDecimal = 0;
|
||||
private Integer inMultiplesOf = null;
|
||||
private final Integer inMultiplesOf = null;
|
||||
|
||||
public MonetaryCurrency build() {
|
||||
return new MonetaryCurrency(code, digitsAfterDecimal,inMultiplesOf);
|
||||
return new MonetaryCurrency(this.code, this.digitsAfterDecimal, this.inMultiplesOf);
|
||||
}
|
||||
|
||||
public MonetaryCurrencyBuilder withCode(final String withCode) {
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ public class MoneyBuilder {
|
||||
private BigDecimal newAmount = BigDecimal.ZERO;
|
||||
|
||||
public Money build() {
|
||||
return Money.of(currencyDetail, newAmount);
|
||||
return Money.of(this.currencyDetail, this.newAmount);
|
||||
}
|
||||
|
||||
public MoneyBuilder with(final MonetaryCurrency withDetail) {
|
||||
|
||||
Reference in New Issue
Block a user