Back to project page DisposableIncome-OldJava.
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.
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()); } }