Example usage for java.lang Short valueOf

List of usage examples for java.lang Short valueOf

Introduction

In this page you can find the example usage for java.lang Short valueOf.

Prototype

@HotSpotIntrinsicCandidate
public static Short valueOf(short s) 

Source Link

Document

Returns a Short instance representing the specified short value.

Usage

From source file:org.eclipse.wb.tests.designer.core.util.reflect.ReflectionUtilsTest.java

/**
 * Test for {@link ReflectionUtils#isAssignableFrom(Class, Object)}.
 *//*w w  w.  jav a  2  s .com*/
public void test_isAssignableFrom() throws Exception {
    assertTrue(ReflectionUtils.isAssignableFrom(Object.class, new Object()));
    assertTrue(ReflectionUtils.isAssignableFrom(Object.class, "string"));
    assertTrue(ReflectionUtils.isAssignableFrom(String.class, "string"));
    assertFalse(ReflectionUtils.isAssignableFrom(Integer.class, "string"));
    assertFalse(ReflectionUtils.isAssignableFrom(String.class, new Object()));
    // 'null'
    assertTrue(ReflectionUtils.isAssignableFrom(String.class, null));
    assertTrue(ReflectionUtils.isAssignableFrom(Integer.class, null));
    assertFalse(ReflectionUtils.isAssignableFrom(int.class, null));
    // primitives
    assertFalse(ReflectionUtils.isAssignableFrom(int.class, "string"));
    assertTrue(ReflectionUtils.isAssignableFrom(byte.class, Byte.valueOf((byte) 0)));
    assertTrue(ReflectionUtils.isAssignableFrom(char.class, Character.valueOf('0')));
    assertTrue(ReflectionUtils.isAssignableFrom(short.class, Short.valueOf((short) 0)));
    assertTrue(ReflectionUtils.isAssignableFrom(int.class, Integer.valueOf(0)));
    assertTrue(ReflectionUtils.isAssignableFrom(long.class, Long.valueOf(0)));
    assertTrue(ReflectionUtils.isAssignableFrom(float.class, Float.valueOf(0.0f)));
    assertTrue(ReflectionUtils.isAssignableFrom(double.class, Double.valueOf(0.0)));
}

From source file:org.mifos.accounts.loan.business.LoanBOIntegrationTest.java

public void testGetTotalRepayAmountForCurrentDateBeforeFirstInstallment() {
    accountBO = getLoanAccount();/*from  w  w w  . j a  v  a2  s . c  o  m*/
    StaticHibernateUtil.commitTransaction();
    StaticHibernateUtil.closeSession();
    accountBO = (AccountBO) StaticHibernateUtil.getSessionTL().get(AccountBO.class, accountBO.getAccountId());
    changeFirstInstallmentDateToNextDate(accountBO);
    Money totalRepaymentAmount = new Money(getCurrency());
    for (AccountActionDateEntity accountAction : accountBO.getAccountActionDates()) {
        LoanScheduleEntity accountActionDateEntity = (LoanScheduleEntity) accountAction;
        if (accountActionDateEntity.getInstallmentId().equals(Short.valueOf("1"))) {
            totalRepaymentAmount = totalRepaymentAmount.add(accountActionDateEntity.getTotalDueWithFees());
        } else {
            totalRepaymentAmount = totalRepaymentAmount.add(accountActionDateEntity.getPrincipal());
        }
    }
    Assert.assertEquals(totalRepaymentAmount, ((LoanBO) accountBO).getTotalEarlyRepayAmount());
}

From source file:org.mifos.accounts.loan.business.LoanBOIntegrationTest.java

public void testGetTotalRepayAmountForCurrentDateSameAsInstallmentDate() {
    accountBO = getLoanAccount();//  w w  w  .  j av a  2 s  .c o m
    StaticHibernateUtil.commitTransaction();
    StaticHibernateUtil.closeSession();
    accountBO = (AccountBO) StaticHibernateUtil.getSessionTL().get(AccountBO.class, accountBO.getAccountId());
    Money totalRepaymentAmount = new Money(getCurrency());
    for (AccountActionDateEntity accountAction : accountBO.getAccountActionDates()) {
        LoanScheduleEntity accountActionDateEntity = (LoanScheduleEntity) accountAction;
        if (accountActionDateEntity.getInstallmentId().equals(Short.valueOf("1"))) {
            totalRepaymentAmount = totalRepaymentAmount.add(accountActionDateEntity.getTotalDueWithFees());
        } else {
            totalRepaymentAmount = totalRepaymentAmount.add(accountActionDateEntity.getPrincipal());
        }
    }
    Assert.assertEquals(totalRepaymentAmount, ((LoanBO) accountBO).getTotalEarlyRepayAmount());
}

From source file:org.mifos.accounts.loan.business.LoanBOIntegrationTest.java

public void testGetTotalRepayAmountForCurrentDateLiesBetweenInstallmentDates() {
    accountBO = getLoanAccount();/*from  w  w w  .j  av  a2s. co  m*/
    StaticHibernateUtil.commitTransaction();
    StaticHibernateUtil.closeSession();
    accountBO = (AccountBO) StaticHibernateUtil.getSessionTL().get(AccountBO.class, accountBO.getAccountId());
    changeFirstInstallmentDate(accountBO);
    Money totalRepaymentAmount = new Money(getCurrency());
    for (AccountActionDateEntity accountAction : accountBO.getAccountActionDates()) {
        LoanScheduleEntity accountActionDateEntity = (LoanScheduleEntity) accountAction;
        if (accountActionDateEntity.getInstallmentId().equals(Short.valueOf("1"))
                || accountActionDateEntity.getInstallmentId().equals(Short.valueOf("2"))) {
            totalRepaymentAmount = totalRepaymentAmount.add(accountActionDateEntity.getTotalDueWithFees());
        } else {
            totalRepaymentAmount = totalRepaymentAmount.add(accountActionDateEntity.getPrincipal());
        }
    }
    Assert.assertEquals(totalRepaymentAmount, ((LoanBO) accountBO).getTotalEarlyRepayAmount());
}

From source file:com.ah.be.common.NmsUtil.java

public static Short[] getNumbersFromRange(String range) {
    List<Short> numbers = new ArrayList<Short>();
    if (range == null || range.trim().length() == 0)
        return null;

    String[] strs = range.split(",");
    for (String str : strs) {
        if (str.trim().length() == 0) {
            return null;
        }/*from   w w w.  j  av  a 2  s  .  c o  m*/

        String[] nums = str.split("-");
        short min;
        short max = 0;
        if (nums.length == 1) {
            if (nums[0].trim().length() == 0 || !nums[0].equals(str))
                return null;
        } else if (nums.length != 2 || nums[0].trim().length() == 0 || nums[1].trim().length() == 0) {
            return null;
        }

        try {
            min = Short.valueOf(nums[0].trim());
            if (nums.length > 1)
                max = Short.valueOf(nums[1].trim());
        } catch (NumberFormatException e) {
            log.error("string does not have the appropriate format", e);
            return null;
        }
        if (nums.length == 1)
            max = min;
        if (min > max || min == 0 || max == 0)
            return null;

        for (short i = 0; min + i <= max; i++) {
            if (!numbers.contains(Short.valueOf((short) (min + i)))) {
                numbers.add((short) (min + i));
            }
        }
    }

    return numbers.toArray(new Short[numbers.size()]);
}

From source file:org.mifos.accounts.loan.business.LoanBOIntegrationTest.java

public void testMakeEarlyRepaymentForCurrentDateLiesBetweenInstallmentDates() throws Exception {
    accountBO = getLoanAccount();//from ww w  .j  a  va2  s  . c  o  m
    StaticHibernateUtil.commitTransaction();
    StaticHibernateUtil.closeSession();
    accountBO = (AccountBO) StaticHibernateUtil.getSessionTL().get(AccountBO.class, accountBO.getAccountId());
    changeFirstInstallmentDate(accountBO);
    LoanBO loanBO = (LoanBO) accountBO;
    UserContext uc = TestUtils.makeUser();
    Money totalRepaymentAmount = loanBO.getTotalEarlyRepayAmount();
    loanBO.makeEarlyRepayment(loanBO.getTotalEarlyRepayAmount(), null, null, "1", uc.getId());

    StaticHibernateUtil.commitTransaction();
    StaticHibernateUtil.closeSession();
    accountBO = (AccountBO) StaticHibernateUtil.getSessionTL().get(AccountBO.class, accountBO.getAccountId());

    Assert.assertEquals(accountBO.getAccountState().getId(),
            Short.valueOf(AccountStates.LOANACC_OBLIGATIONSMET));
    LoanSummaryEntity loanSummaryEntity = loanBO.getLoanSummary();
    Assert.assertEquals(totalRepaymentAmount,
            loanSummaryEntity.getPrincipalPaid().add(loanSummaryEntity.getFeesPaid())
                    .add(loanSummaryEntity.getInterestPaid()).add(loanSummaryEntity.getPenaltyPaid()));
    Assert.assertEquals(1, accountBO.getAccountPayments().size());
    // / Change this to more clearly separate what we are testing for from
    // the
    // machinery needed to get that data?
    //
    for (AccountPaymentEntity accountPaymentEntity : accountBO.getAccountPayments()) {
        Assert.assertEquals(6, accountPaymentEntity.getAccountTrxns().size());
        for (AccountTrxnEntity accountTrxnEntity : accountPaymentEntity.getAccountTrxns()) {
            if (accountTrxnEntity.getInstallmentId().equals(Short.valueOf("1"))
                    || accountTrxnEntity.getInstallmentId().equals(Short.valueOf("2"))) {
                Assert.assertEquals(new Money(getCurrency(), "212.0"), accountTrxnEntity.getAmount());
                LoanTrxnDetailEntity loanTrxnDetailEntity = (LoanTrxnDetailEntity) accountTrxnEntity;
                Assert.assertEquals(new Money(getCurrency(), "100.0"),
                        loanTrxnDetailEntity.getPrincipalAmount());
                Assert.assertEquals(new Money(getCurrency(), "12.0"), loanTrxnDetailEntity.getInterestAmount());
                Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getMiscFeeAmount());
                Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getMiscPenaltyAmount());
                Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getPenaltyAmount());
                Assert.assertEquals(6, accountTrxnEntity.getFinancialTransactions().size());
                Assert.assertEquals(1, loanTrxnDetailEntity.getFeesTrxnDetails().size());
                for (FeesTrxnDetailEntity feesTrxnDetailEntity : loanTrxnDetailEntity.getFeesTrxnDetails()) {
                    Assert.assertEquals(new Money(getCurrency(), "100.0"), feesTrxnDetailEntity.getFeeAmount());
                }
            } else {
                LoanTrxnDetailEntity loanTrxnDetailEntity = (LoanTrxnDetailEntity) accountTrxnEntity;
                Assert.assertEquals(new Money(getCurrency(), "100.0"), accountTrxnEntity.getAmount());
                Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getInterestAmount());
                Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getMiscFeeAmount());
                Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getMiscPenaltyAmount());
                Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getPenaltyAmount());
                Assert.assertEquals(2, accountTrxnEntity.getFinancialTransactions().size());
                Assert.assertEquals(0, loanTrxnDetailEntity.getFeesTrxnDetails().size());
            }
        }
    }
}

From source file:org.mifos.accounts.loan.business.LoanCalculationIntegrationTest.java

private FeeDto createPeriodicFeeView(InternalConfiguration config, LoanParameters loanParams,
        MeetingBO meeting) {/*from   w  w  w  .  j  a  va 2 s . com*/
    FeeBO fee = null;
    if (config.isFeeRateBased()) {
        fee = TestObjectFactory.createPeriodicRateFee("testLoanFee", FeeCategory.LOAN,
                new Double(config.getFeePercentage()), config.getFeeType(), loanParams.getPaymentFrequency(),
                (short) 1, userContext, meeting);
    } else {
        fee = TestObjectFactory.createPeriodicAmountFee("testLoanFee", FeeCategory.LOAN, config.getFeeValue(),
                loanParams.getPaymentFrequency(), Short.valueOf("1"));
    }

    FeeDto feeDto = new FeeDto(userContext, fee);
    return feeDto;
}

From source file:org.mifos.application.servicefacade.LoanAccountServiceFacadeWebTier.java

@Override
public LoanDisbursalDto retrieveLoanDisbursalDetails(Integer loanAccountId) {

    try {/* w w w.j  a va  2  s.  c o m*/
        LoanBO loan = this.loanDao.findById(loanAccountId);
        new ProductMixValidator().checkIfProductsOfferingCanCoexist(loan);

        Date proposedDate = new DateTimeService().getCurrentJavaDateTime();
        boolean backDatedTransactionsAllowed = AccountingRules.isBackDatedTxnAllowed();
        if (backDatedTransactionsAllowed) {
            proposedDate = loan.getDisbursementDate();
        }

        Short currencyId = Short.valueOf("0");
        boolean multiCurrencyEnabled = AccountingRules.isMultiCurrencyEnabled();
        if (multiCurrencyEnabled) {
            currencyId = loan.getCurrency().getCurrencyId();
        }

        boolean repaymentIndependentOfMeetingSchedule = new ConfigurationPersistence()
                .isRepaymentIndepOfMeetingEnabled();

        return new LoanDisbursalDto(loan.getAccountId(), proposedDate, loan.getLoanAmount().toString(),
                loan.getAmountTobePaidAtdisburtail().toString(), backDatedTransactionsAllowed,
                repaymentIndependentOfMeetingSchedule, multiCurrencyEnabled, currencyId);
    } catch (PersistenceException e) {
        throw new MifosRuntimeException(e);
    } catch (AccountException e) {
        throw new BusinessRuleException(e.getKey(), e.getValues());
    } catch (ServiceException e) {
        throw new MifosRuntimeException(e);
    }
}

From source file:org.mifos.accounts.loan.business.LoanBOIntegrationTest.java

public void testMakeEarlyRepaymentForCurrentDateSameAsInstallmentDate() throws Exception {
    accountBO = getLoanAccount();//from  w ww. j  a v  a  2  s.c o m
    StaticHibernateUtil.commitTransaction();
    StaticHibernateUtil.closeSession();
    accountBO = (AccountBO) StaticHibernateUtil.getSessionTL().get(AccountBO.class, accountBO.getAccountId());
    LoanBO loanBO = (LoanBO) accountBO;
    UserContext uc = TestUtils.makeUser();
    Money totalRepaymentAmount = loanBO.getTotalEarlyRepayAmount();
    loanBO.makeEarlyRepayment(loanBO.getTotalEarlyRepayAmount(), null, null, "1", uc.getId());

    StaticHibernateUtil.commitTransaction();
    StaticHibernateUtil.closeSession();
    accountBO = (AccountBO) StaticHibernateUtil.getSessionTL().get(AccountBO.class, accountBO.getAccountId());

    Assert.assertEquals(accountBO.getAccountState().getId(),
            Short.valueOf(AccountStates.LOANACC_OBLIGATIONSMET));
    LoanSummaryEntity loanSummaryEntity = loanBO.getLoanSummary();
    Assert.assertEquals(totalRepaymentAmount,
            loanSummaryEntity.getPrincipalPaid().add(loanSummaryEntity.getFeesPaid())
                    .add(loanSummaryEntity.getInterestPaid()).add(loanSummaryEntity.getPenaltyPaid()));
    Assert.assertEquals(1, accountBO.getAccountPayments().size());

    // Change this to more clearly separate what we are testing for from the
    // machinery needed to get that data?

    for (AccountPaymentEntity accountPaymentEntity : accountBO.getAccountPayments()) {
        Assert.assertEquals(6, accountPaymentEntity.getAccountTrxns().size());
        for (AccountTrxnEntity accountTrxnEntity : accountPaymentEntity.getAccountTrxns()) {
            if (accountTrxnEntity.getInstallmentId().equals(Short.valueOf("1"))) {
                Assert.assertEquals(new Money(getCurrency(), "212.0"), accountTrxnEntity.getAmount());
                LoanTrxnDetailEntity loanTrxnDetailEntity = (LoanTrxnDetailEntity) accountTrxnEntity;
                Assert.assertEquals(new Money(getCurrency(), "100.0"),
                        loanTrxnDetailEntity.getPrincipalAmount());
                Assert.assertEquals(new Money(getCurrency(), "12.0"), loanTrxnDetailEntity.getInterestAmount());
                Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getMiscFeeAmount());
                Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getMiscPenaltyAmount());
                Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getPenaltyAmount());
                Assert.assertEquals(6, accountTrxnEntity.getFinancialTransactions().size());
                Assert.assertEquals(1, loanTrxnDetailEntity.getFeesTrxnDetails().size());
                for (FeesTrxnDetailEntity feesTrxnDetailEntity : loanTrxnDetailEntity.getFeesTrxnDetails()) {
                    Assert.assertEquals(new Money(getCurrency(), "100.0"), feesTrxnDetailEntity.getFeeAmount());
                }
            } else {
                LoanTrxnDetailEntity loanTrxnDetailEntity = (LoanTrxnDetailEntity) accountTrxnEntity;
                Assert.assertEquals(new Money(getCurrency(), "100.0"), accountTrxnEntity.getAmount());
                Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getInterestAmount());
                Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getMiscFeeAmount());
                Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getMiscPenaltyAmount());
                Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getPenaltyAmount());
                Assert.assertEquals(2, accountTrxnEntity.getFinancialTransactions().size());
                Assert.assertEquals(0, loanTrxnDetailEntity.getFeesTrxnDetails().size());
            }
        }
    }
}

From source file:org.mifos.accounts.loan.business.LoanBOIntegrationTest.java

public void testMakeEarlyRepaymentOnPartiallyPaidAccount() throws Exception {
    Date startDate = new Date(System.currentTimeMillis());
    MeetingBO meeting = TestObjectFactory.createMeeting(
            TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_SECOND_WEEK, CUSTOMER_MEETING));
    center = TestObjectFactory.createWeeklyFeeCenter(this.getClass().getSimpleName() + " Center", meeting);
    group = TestObjectFactory.createWeeklyFeeGroupUnderCenter(this.getClass().getSimpleName() + " Group",
            CustomerStatus.GROUP_ACTIVE, center);
    LoanOfferingBO loanOffering = createOfferingNoPrincipalInLastInstallment(startDate,
            center.getCustomerMeeting().getMeeting());
    UserContext userContext = TestUtils.makeUser();
    userContext.setLocaleId(null);/*from   www .ja  v  a  2 s  . c  om*/
    List<FeeView> feeViewList = new ArrayList<FeeView>();
    FeeBO periodicFee = TestObjectFactory.createPeriodicAmountFee("Periodic Fee", FeeCategory.LOAN, "100",
            RecurrenceType.WEEKLY, Short.valueOf("1"));
    feeViewList.add(new FeeView(userContext, periodicFee));
    FeeBO upfrontFee = TestObjectFactory.createOneTimeRateFee("Upfront Fee", FeeCategory.LOAN,
            Double.valueOf("20"), FeeFormula.AMOUNT, FeePayment.UPFRONT);
    feeViewList.add(new FeeView(userContext, upfrontFee));
    LoanOfferingInstallmentRange eligibleInstallmentRange = loanOffering.getEligibleInstallmentSameForAllLoan();

    accountBO = LoanBO.createLoan(TestUtils.makeUser(), loanOffering, group,
            AccountState.LOAN_ACTIVE_IN_GOOD_STANDING, new Money(getCurrency(), "300.0"), Short.valueOf("6"),
            startDate, false, 1.2, (short) 0, null, feeViewList, getCustomFields(), DEFAULT_LOAN_AMOUNT,
            DEFAULT_LOAN_AMOUNT, eligibleInstallmentRange.getMaxNoOfInstall(),
            eligibleInstallmentRange.getMinNoOfInstall(), false, null);
    new TestObjectPersistence().persist(accountBO);
    Assert.assertEquals(6, accountBO.getAccountActionDates().size());
    Assert.assertEquals(1, accountBO.getAccountCustomFields().size());
    StaticHibernateUtil.closeSession();

    accountBO = (AccountBO) StaticHibernateUtil.getSessionTL().get(AccountBO.class, accountBO.getAccountId());
    accountBO.applyPaymentWithPersist(TestObjectFactory.getLoanAccountPaymentData(null,
            new Money(getCurrency(), "160"), accountBO.getCustomer(), accountBO.getPersonnel(), "432423",
            (short) 1, startDate, startDate));

    StaticHibernateUtil.commitTransaction();
    StaticHibernateUtil.closeSession();
    accountBO = (AccountBO) StaticHibernateUtil.getSessionTL().get(AccountBO.class, accountBO.getAccountId());
    Assert.assertEquals(new Money(getCurrency()), ((LoanBO) accountBO).getTotalPaymentDue());
    LoanBO loanBO = (LoanBO) accountBO;
    UserContext uc = TestUtils.makeUser();
    Money totalRepaymentAmount = loanBO.getTotalEarlyRepayAmount();
    Assert.assertEquals(new Money(getCurrency(), "300.2"), totalRepaymentAmount);
    loanBO.makeEarlyRepayment(loanBO.getTotalEarlyRepayAmount(), null, null, "1", uc.getId());

    StaticHibernateUtil.commitTransaction();
    StaticHibernateUtil.closeSession();
    accountBO = (AccountBO) StaticHibernateUtil.getSessionTL().get(AccountBO.class, accountBO.getAccountId());

    Assert.assertEquals(accountBO.getAccountState().getId(),
            Short.valueOf(AccountStates.LOANACC_OBLIGATIONSMET));
    LoanSummaryEntity loanSummaryEntity = loanBO.getLoanSummary();
    Assert.assertEquals(new Money(getCurrency()),
            loanSummaryEntity.getPrincipalDue().add(loanSummaryEntity.getFeesDue())
                    .add(loanSummaryEntity.getInterestDue()).add(loanSummaryEntity.getPenaltyDue()));
    Assert.assertEquals(2, accountBO.getAccountPayments().size());
    AccountPaymentEntity accountPaymentEntity = (AccountPaymentEntity) Arrays
            .asList(accountBO.getAccountPayments().toArray()).get(0);

    // Change this to more clearly separate what we are testing for from the
    // machinery needed to get that data?

    for (AccountTrxnEntity accountTrxnEntity : accountPaymentEntity.getAccountTrxns()) {
        if (accountTrxnEntity.getInstallmentId().equals(Short.valueOf("6"))) {
            LoanTrxnDetailEntity loanTrxnDetailEntity = (LoanTrxnDetailEntity) accountTrxnEntity;
            Assert.assertEquals(new Money(getCurrency(), "46.0"), accountTrxnEntity.getAmount());
            Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getInterestAmount());
            Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getMiscFeeAmount());
            Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getMiscPenaltyAmount());
            Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getPenaltyAmount());
            Assert.assertEquals(2, accountTrxnEntity.getFinancialTransactions().size());
            Assert.assertEquals(0, loanTrxnDetailEntity.getFeesTrxnDetails().size());
        } else if (accountTrxnEntity.getInstallmentId().equals(Short.valueOf("1"))) {
            LoanTrxnDetailEntity loanTrxnDetailEntity = (LoanTrxnDetailEntity) accountTrxnEntity;
            Assert.assertEquals(new Money(getCurrency(), "51.0"), accountTrxnEntity.getAmount());
            Assert.assertEquals(new Money(getCurrency(), "0.2"), loanTrxnDetailEntity.getInterestAmount());
            Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getMiscFeeAmount());
            Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getMiscPenaltyAmount());
            Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getPenaltyAmount());
            Assert.assertEquals(4, accountTrxnEntity.getFinancialTransactions().size());
            Assert.assertEquals(0, loanTrxnDetailEntity.getFeesTrxnDetails().size());
        } else {
            LoanTrxnDetailEntity loanTrxnDetailEntity = (LoanTrxnDetailEntity) accountTrxnEntity;
            Assert.assertEquals(new Money(getCurrency(), "50.8"), accountTrxnEntity.getAmount());
            Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getInterestAmount());
            Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getMiscFeeAmount());
            Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getMiscPenaltyAmount());
            Assert.assertEquals(new Money(getCurrency()), loanTrxnDetailEntity.getPenaltyAmount());
            Assert.assertEquals(2, accountTrxnEntity.getFinancialTransactions().size());
            Assert.assertEquals(0, loanTrxnDetailEntity.getFeesTrxnDetails().size());
        }
    }
}