Android Open Source - DisposableIncome-OldJava Cash Test






From Project

Back to project page DisposableIncome-OldJava.

License

The source code is released under:

MIT License

If you think the Android project DisposableIncome-OldJava listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package uk.co.wilka.disposableincome.test;
/*from w w w  . j  a  v a2s .  c  om*/
import junit.framework.TestCase;

import uk.co.wilka.disposableincome.Cash;

public class CashTest extends TestCase {

    public void test_fromPence_GivesCorrectPoundsValue() {
        Cash c = Cash.fromPence(100);

        assertEquals(1, c.getPounds());
    }

    public void test_fromPounds_GivesCorrectPenceValue() {
        Cash c = Cash.fromPounds(10);

        assertEquals(1000, c.getPence());
    }

    public void test_10pencePlus5pence_Gives15pence() {
        Cash c1 = Cash.fromPence(10);
        Cash c2 = Cash.fromPence(5);

        assertEquals(15, c1.plus(c2).getPence());
    }

    public void test_2poundsPlus5pounds_Gives7pounds() {
        Cash c1 = Cash.fromPounds(2);
        Cash c2 = Cash.fromPounds(5);

        assertEquals(7, c1.plus(c2).getPounds());
    }

    public void test_10poundsMinus3pounds_Gives6pounds() {
        Cash c1 = Cash.fromPounds(10);
        Cash c2 = Cash.fromPounds(3);

        assertEquals(7, c1.minus(c2).getPounds());
    }
}




Java Source Code List

uk.co.wilka.disposableincome.CalendarAccess.java
uk.co.wilka.disposableincome.CalendarProvider.java
uk.co.wilka.disposableincome.CashWithdraw.java
uk.co.wilka.disposableincome.CashWithdrawalDetailsActivity.java
uk.co.wilka.disposableincome.Cash.java
uk.co.wilka.disposableincome.DatabaseHelper.java
uk.co.wilka.disposableincome.IAccessData.java
uk.co.wilka.disposableincome.IProvideCalendar.java
uk.co.wilka.disposableincome.MainActivity.java
uk.co.wilka.disposableincome.PlusOneMonthCalendarProvider.java
uk.co.wilka.disposableincome.WithdrawDateComparer.java
uk.co.wilka.disposableincome.WithdrawType.java
uk.co.wilka.disposableincome.WithdrawalForMonthCalculator.java
uk.co.wilka.disposableincome.test.CashTest.java
uk.co.wilka.disposableincome.test.CashWithdrawTest.java
uk.co.wilka.disposableincome.test.FakeCalendarProvider.java
uk.co.wilka.disposableincome.test.PlusOneMonthCalendarProviderTests.java
uk.co.wilka.disposableincome.test.WithdrawDateComparerTests.java
uk.co.wilka.disposableincome.test.WithdrawalForMonthCalculatorTests.java