blob: 688511096a43b7fd5406151a2028481f18fdc741 [file] [log] [blame]
Anton Hansson4ec07fa2019-11-08 15:18:04 +00001/*
2 * Copyright (C) 2019 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.os.ext;
18
19import android.os.Build;
20import android.test.suitebuilder.annotation.SmallTest;
21
22import junit.framework.TestCase;
23
24public class SdkExtensionsTest extends TestCase {
25
26 @SmallTest
27 public void testBadArgument() throws Exception {
28 try {
29 SdkExtensions.getExtensionVersion(Build.VERSION_CODES.Q);
30 fail("expected IllegalArgumentException");
31 } catch (IllegalArgumentException expected) { }
32
33 try {
34 SdkExtensions.getExtensionVersion(999999);
35 fail("expected IllegalArgumentException");
36 } catch (IllegalArgumentException expected) { }
37 }
38
39 @SmallTest
40 public void testDefault() throws Exception {
41 int r = SdkExtensions.getExtensionVersion(Build.VERSION_CODES.R);
42 assertTrue(r >= 0);
43 }
44
45}