<commit_before>/**
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package org.mifosplatform.portfolio.loanaccount;

import java.lang.reflect.Field;
import java.util.List;

import org.joda.time.LocalDate;
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.MoneyHelper;
import org.mifosplatform.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment;
import org.mifosplatform.portfolio.loanaccount.domain.transactionprocessor.impl.HeavensFamilyLoanRepaymentScheduleTransactionProcessor;
import org.mockito.runners.MockitoJUnitRunner;

@SuppressWarnings("unused")
@RunWith(MockitoJUnitRunner.class)
public class HeavensFamilyLoanRepaymentScheduleTransactionProcessorTest {

    // class under test
    private HeavensFamilyLoanRepaymentScheduleTransactionProcessor 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() throws Exception {

        Field field = MoneyHelper.class.getDeclaredField("roundingModeIntValue");
        field.setAccessible(true);
        field.setInt(null, 6);
        this.installments = LoanScheduleTestDataHelper.createSimpleLoanSchedule(this.july2nd, this.usDollars);

        this.processor = new HeavensFamilyLoanRepaymentScheduleTransactionProcessor();
    }

    /**
     * Scenario 1: Single transaction which is less than the interest component
     * of the first installment.
     * <commit_msg>MIFOSX-2148 : fixed junit test case<commit_after>/**
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package org.mifosplatform.portfolio.loanaccount;

import java.lang.reflect.Field;
import java.math.RoundingMode;
import java.util.List;

import org.joda.time.LocalDate;
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.MoneyHelper;
import org.mifosplatform.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment;
import org.mifosplatform.portfolio.loanaccount.domain.transactionprocessor.impl.HeavensFamilyLoanRepaymentScheduleTransactionProcessor;
import org.mockito.runners.MockitoJUnitRunner;

@SuppressWarnings("unused")
@RunWith(MockitoJUnitRunner.class)
public class HeavensFamilyLoanRepaymentScheduleTransactionProcessorTest {

    // class under test
    private HeavensFamilyLoanRepaymentScheduleTransactionProcessor 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() throws Exception {

        Field field = MoneyHelper.class.getDeclaredField("roundingMode");
        field.setAccessible(true);
        field.set(null, RoundingMode.HALF_EVEN);
        this.installments = LoanScheduleTestDataHelper.createSimpleLoanSchedule(this.july2nd, this.usDollars);

        this.processor = new HeavensFamilyLoanRepaymentScheduleTransactionProcessor();
    }

    /**
     * Scenario 1: Single transaction which is less than the interest component
     * of the first installment.
     * 
{'fraction_non_alphanumeric': 0.08475874393668624, 'fraction_numerical': 0.008424814909369416, 'mean_word_length': 4.990825688073395, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2504260', 'n_tokens_mistral': 1160, 'n_tokens_neox': 1122, 'n_words': 246}