blob: 372a652d103a73bf7dd72abc3efd5b21feabd571 [file] [log] [blame]
Xi Chena455bd52016-07-25 17:00:22 -07001/*
2 * Copyright (C) 2016 The Android Open Source Project
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.contacts.util;
17
18import android.accounts.Account;
19import android.test.AndroidTestCase;
20import android.test.suitebuilder.annotation.SmallTest;
21
22import java.util.ArrayList;
23import java.util.List;
24
25/**
26 * Tests for SyncUtil.
27 */
28@SmallTest
29public class SyncUtilTests extends AndroidTestCase {
30 private static final String TAG = "SyncUtilTests";
31
32 private static final String GOOGLE_TYPE = "com.google";
33 private static final String NOT_GOOGLE_TYPE = "com.abc";
34 private static final String ACCOUNT_NAME = "ACCOUNT_NAME";
35
36 private final Account mGoogleAccount;
37 private final Account mOtherAccount;
38
39 public SyncUtilTests() {
40 mGoogleAccount = new Account(ACCOUNT_NAME, GOOGLE_TYPE);
41 mOtherAccount = new Account(ACCOUNT_NAME, NOT_GOOGLE_TYPE);
42 }
43
44 public void testIsUnsyncableGoogleAccount() throws Exception {
45 // The account names of mGoogleAccount and mOtherAccount are not valid, so both accounts
46 // are not syncable.
47 assertTrue(SyncUtil.isUnsyncableGoogleAccount(mGoogleAccount));
48 assertFalse(SyncUtil.isUnsyncableGoogleAccount(mOtherAccount));
49 assertFalse(SyncUtil.isUnsyncableGoogleAccount(null));
50 }
51}