package com.ruoyi.dk.util;

import java.math.BigDecimal;

/**
 * Created by WangGenshen on 1/14/16.
 */
public class LoanCalculatorTest {

    private int totalMonth;
    private BigDecimal totalMoney;
    private double percent;
    private double rate;
    private double rateDiscount;

    protected void setUp() throws Exception {
        totalMonth = 36;
        totalMoney = new BigDecimal(50000);
        percent = 0;
        rate = 10.8;
        rateDiscount = 1;
    }

    public static void main(String[] args) {
        ACPIMLoanCalculator calculator = new ACPIMLoanCalculator();
        Loan loan = calculator.calLoan(
                LoanUtil.totalLoanMoney(new BigDecimal(50000), 2),
                36,
                0.6,
                LoanUtil.RATE_TYPE_MONTH);
        System.out.println("asd");
    }


    public void testACPIMCalculate() {
        ACPIMLoanCalculator calculator = new ACPIMLoanCalculator();
        Loan loan = calculator.calLoan(
                LoanUtil.totalLoanMoney(totalMoney, percent),
                totalMonth,
                LoanUtil.rate(rate, rateDiscount),
                LoanUtil.RATE_TYPE_YEAR);
        System.out.println(loan);
    }

    public void testACMCalculate() {
        ACMLoanCalculator calculator = new ACMLoanCalculator();
        Loan loan = calculator.calLoan(
                LoanUtil.totalLoanMoney(totalMoney, percent),
                totalMonth,
                LoanUtil.rate(rate, rateDiscount),
                LoanUtil.RATE_TYPE_YEAR);
        System.out.println(loan);
    }

}
