• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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  */
16 package com.android.contacts.util;
17 
18 import android.accounts.Account;
19 import android.test.AndroidTestCase;
20 import android.test.suitebuilder.annotation.SmallTest;
21 
22 /**
23  * Tests for SyncUtil.
24  */
25 @SmallTest
26 public class SyncUtilTests extends AndroidTestCase {
27     private static final String TAG = "SyncUtilTests";
28 
29     private static final String GOOGLE_TYPE = "com.google";
30     private static final String NOT_GOOGLE_TYPE = "com.abc";
31     private static final String ACCOUNT_NAME = "ACCOUNT_NAME";
32 
33     private final Account mGoogleAccount;
34     private final Account mOtherAccount;
35 
SyncUtilTests()36     public SyncUtilTests() {
37         mGoogleAccount = new Account(ACCOUNT_NAME, GOOGLE_TYPE);
38         mOtherAccount = new Account(ACCOUNT_NAME, NOT_GOOGLE_TYPE);
39     }
40 
testIsUnsyncableGoogleAccount()41     public void testIsUnsyncableGoogleAccount() throws Exception {
42         // The account names of mGoogleAccount and mOtherAccount are not valid, so both accounts
43         // are not syncable.
44         assertTrue(SyncUtil.isUnsyncableGoogleAccount(mGoogleAccount));
45         assertFalse(SyncUtil.isUnsyncableGoogleAccount(mOtherAccount));
46         assertFalse(SyncUtil.isUnsyncableGoogleAccount(null));
47     }
48 }
49