Search in sources :

Example 46 with MifosCurrency

use of org.mifos.application.master.business.MifosCurrency in project head by mifos.

the class RepaymentScheduleInstallmentTest method setUp.

@Before
public void setUp() throws Exception {
    locale = new Locale("en", "GB");
    installmentBuilder = new RepaymentScheduleInstallmentBuilder(locale);
    rupee = new MifosCurrency(Short.valueOf("1"), "Rupee", BigDecimal.valueOf(1), "INR");
}
Also used : Locale(java.util.Locale) MifosCurrency(org.mifos.application.master.business.MifosCurrency) Before(org.junit.Before)

Example 47 with MifosCurrency

use of org.mifos.application.master.business.MifosCurrency in project head by mifos.

the class LoanAccountServiceFacadeWebTierTest method setupAndInjectDependencies.

@Before
public void setupAndInjectDependencies() {
    loanAccountServiceFacade = new LoanAccountServiceFacadeWebTier(officeDao, loanProductDao, customerDao, personnelDao, fundDao, loanDao, accountService, scheduleCalculatorAdaptor, loanBusinessService, loanScheduleService, installmentsValidator, holidayServiceFacade, monthClosingServiceFacade, customerPersistence, configurationPersistence, clientServiceFacade, savingsServiceFacade);
    ((LoanAccountServiceFacadeWebTier) loanAccountServiceFacade).setTransactionHelper(hibernateTransactionHelper);
    rupee = new MifosCurrency(Short.valueOf("1"), "Rupee", BigDecimal.valueOf(1), "INR");
    userContext = TestUtils.makeUser();
}
Also used : MifosCurrency(org.mifos.application.master.business.MifosCurrency) Before(org.junit.Before)

Example 48 with MifosCurrency

use of org.mifos.application.master.business.MifosCurrency in project head by mifos.

the class WebTierAccountServiceFacadeTest method setUp.

@Before
public void setUp() throws Exception {
    accountServiceFacade = new WebTierAccountServiceFacade(null, transactionHelper, accountBusinessService, scheduleCalculatorAdaptor, acceptedPaymentTypePersistence, personnelPersistence, legacyAccountDao, monthClosingServiceFacade, clientServiceFacade, savingsServiceFacade) {

        @Override
        void clearSessionAndRollback() {
        // do nothing
        }

        @Override
        UserContext getUserContext() {
            return userContext;
        }
    };
    rupee = new MifosCurrency(Short.valueOf("1"), "Rupee", BigDecimal.valueOf(1), "INR");
}
Also used : UserContext(org.mifos.security.util.UserContext) MifosCurrency(org.mifos.application.master.business.MifosCurrency) Before(org.junit.Before)

Example 49 with MifosCurrency

use of org.mifos.application.master.business.MifosCurrency in project head by mifos.

the class CollectionSheetDtoTranslatorImplTest method setupStaticClientRules.

@BeforeClass
public static void setupStaticClientRules() {
    defaultCurrency = new MifosCurrency(defaultCurrencyId, null, null, null);
    Money.setDefaultCurrency(defaultCurrency);
}
Also used : MifosCurrency(org.mifos.application.master.business.MifosCurrency) BeforeClass(org.junit.BeforeClass)

Example 50 with MifosCurrency

use of org.mifos.application.master.business.MifosCurrency in project head by mifos.

the class LocalizationConverterTest method testParseDoubleForCashFlowValidations.

@Test
public void testParseDoubleForCashFlowValidations() {
    MifosCurrency mifosCurrency = new MifosCurrency(Short.valueOf("1"), "Rupee", BigDecimal.valueOf(1), "INR");
    LocalizationConverter localizationConverter = new LocalizationConverter(mifosCurrency);
    DoubleConversionResult result = parseForCashFlow(localizationConverter, "22.59");
    assertThat(result.getDoubleValue(), is(22.59));
    result = parseForCashFlow(localizationConverter, "222,59562");
    assertThat(result.getErrors().get(0), is(ConversionError.NOT_ALL_NUMBER));
    result = parseForCashFlow(localizationConverter, "2a5922");
    assertThat(result.getErrors().get(0), is(ConversionError.NOT_ALL_NUMBER));
    result = parseForCashFlow(localizationConverter, "22222222222.5");
    assertThat(result.getErrors().get(0), is(ConversionError.EXCEEDING_NUMBER_OF_DIGITS_BEFORE_DECIMAL_SEPARATOR_FOR_CASHFLOW_VALIDATION));
    result = parseForCashFlow(localizationConverter, "222.595690");
    assertThat(result.getErrors().get(0), is(ConversionError.EXCEEDING_NUMBER_OF_DIGITS_AFTER_DECIMAL_SEPARATOR_FOR_CASHFLOW_VALIDATION));
    result = parseForCashFlow(localizationConverter, "222.59");
    assertThat(result.getErrors().get(0), is(ConversionError.CASH_FLOW_THRESHOLD_OUT_OF_RANGE));
}
Also used : DoubleConversionResult(org.mifos.framework.util.helpers.DoubleConversionResult) MifosCurrency(org.mifos.application.master.business.MifosCurrency) Test(org.junit.Test)

Aggregations

MifosCurrency (org.mifos.application.master.business.MifosCurrency)54 Money (org.mifos.framework.util.helpers.Money)26 ArrayList (java.util.ArrayList)16 Test (org.junit.Test)12 BigDecimal (java.math.BigDecimal)10 Date (java.util.Date)10 HashMap (java.util.HashMap)10 Before (org.junit.Before)8 List (java.util.List)7 Locale (java.util.Locale)7 MifosRuntimeException (org.mifos.core.MifosRuntimeException)7 RepaymentScheduleInstallment (org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment)5 RepaymentScheduleInstallmentBuilder (org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallmentBuilder)5 MeetingBO (org.mifos.application.meeting.business.MeetingBO)4 LocalDate (org.joda.time.LocalDate)3 GLCodeEntity (org.mifos.accounts.financial.business.GLCodeEntity)3 PersistenceException (org.mifos.framework.exceptions.PersistenceException)3 DoubleConversionResult (org.mifos.framework.util.helpers.DoubleConversionResult)3 BigInteger (java.math.BigInteger)2 Calendar (java.util.Calendar)2