Android Open Source - DisposableIncome-OldJava Cash Withdraw 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;
/* ww  w  .j  av a  2 s.c o  m*/
import android.os.Parcel;
import junit.framework.TestCase;

import java.util.Date;

import uk.co.wilka.disposableincome.Cash;
import uk.co.wilka.disposableincome.CashWithdraw;
import uk.co.wilka.disposableincome.WithdrawType;

public class CashWithdrawTest extends TestCase {

    public void test_writeToParcel_GivesBackMatchingObject() {
        writeThenReadFromParcelAndAssertEqual(new CashWithdraw(new Date(2012, 1, 1), Cash.fromPounds(10), WithdrawType.Actual, "Notes"));
        writeThenReadFromParcelAndAssertEqual(new CashWithdraw(new Date(2011, 3, 5), Cash.fromPounds(25), WithdrawType.Predicted, "Different notes"));
    }

    private void writeThenReadFromParcelAndAssertEqual(CashWithdraw original) {
        Parcel parcel = Parcel.obtain();

        parcel.writeParcelable(original, 0);
        parcel.setDataPosition(0);
        CashWithdraw fromParcel = parcel.readParcelable(this.getClass().getClassLoader());

        assertEquals(original.getDate(), fromParcel.getDate());
        assertEquals(original.getAmount().getPence(), fromParcel.getAmount().getPence());
        assertEquals(original.getWithdrawType(), fromParcel.getWithdrawType());
        assertEquals(original.getNotes(), fromParcel.getNotes());
    }
}




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