AccountTests.java revision 33fe908589dca6a7f58aa9f56d73f74a48ac42f6
1/** 2 * Copyright (c) 2012, Google Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16package com.android.mail.providers; 17 18import android.content.Intent; 19import android.test.AndroidTestCase; 20 21import com.android.mail.utils.Utils; 22 23public class AccountTests extends AndroidTestCase { 24 25 public void testSerializeDeSerialize() { 26 String name = "account@account.com"; 27 Account account = new Account(name, "uknown"); 28 account.accountFromAddressesUri = "fromAddresses"; 29 account.capabilities = 12345; 30 account.providerVersion = 1; 31 account.accountUri = "accountUri"; 32 account.folderListUri = "foldersList"; 33 account.searchUri = "searchUri"; 34 account.saveDraftUri = "saveDraftUri"; 35 account.sendMessageUri = "sendMessageUri"; 36 Intent intent = new Intent(); 37 intent.putExtra(Utils.EXTRA_ACCOUNT, account); 38 Account outAccount = (Account) intent.getParcelableExtra(Utils.EXTRA_ACCOUNT); 39 assertEquals(outAccount.name, account.name); 40 assertEquals(outAccount.accountFromAddressesUri, account.accountFromAddressesUri); 41 assertEquals(outAccount.capabilities, account.capabilities); 42 assertEquals(outAccount.providerVersion, account.providerVersion); 43 assertEquals(outAccount.accountUri, account.accountUri); 44 assertEquals(outAccount.folderListUri, account.folderListUri); 45 assertEquals(outAccount.searchUri, account.searchUri); 46 assertEquals(outAccount.saveDraftUri, account.saveDraftUri); 47 assertEquals(outAccount.sendMessageUri, account.sendMessageUri); 48 } 49}