1/* 2 * Copyright (C) 2017 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 17package android.content; 18 19import android.test.AndroidTestCase; 20import android.test.suitebuilder.annotation.SmallTest; 21 22 23/* 24 runtest -c android.content.ContentValuesTest frameworks-core 25 26 or 27 28 make -j256 FrameworksCoreTests && \ 29 adb shell pm uninstall -k com.android.frameworks.coretests && \ 30 adb install out/target/product/bullhead/testcases/FrameworksCoreTests/FrameworksCoreTests.apk && \ 31 adb shell am instrument -w -e package android.content \ 32 com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner 33*/ 34public class ContentValuesTest extends AndroidTestCase { 35 36 @SmallTest 37 public void testIsEmpty() throws Exception { 38 ContentValues cv = new ContentValues(); 39 assertTrue(cv.isEmpty()); 40 assertEquals(0, cv.size()); 41 42 cv.put("key", "value"); 43 assertFalse(cv.isEmpty()); 44 assertEquals(1, cv.size()); 45 } 46} 47