1 /*
2  * Copyright (C) 2024 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.bedstead.flags
17 
18 import android.app.admin.flags.Flags
19 import com.android.bedstead.flags.annotations.RequireFlagsDisabled
20 import com.android.bedstead.flags.annotations.RequireFlagsEnabled
21 import com.android.bedstead.harrier.BedsteadJUnit4
22 import com.android.bedstead.harrier.DeviceState
23 import com.google.common.truth.Truth.assertThat
24 import org.junit.ClassRule
25 import org.junit.Rule
26 import org.junit.Test
27 import org.junit.runner.RunWith
28 
29 @RunWith(BedsteadJUnit4::class)
30 class FlagsTest {
31 
32     @Test
33     @RequireFlagsEnabled(Flags.FLAG_DUMPSYS_POLICY_ENGINE_MIGRATION_ENABLED)
requireFlagEnabledAnnotation_flagIsEnablednull34     fun requireFlagEnabledAnnotation_flagIsEnabled() {
35         assertThat(Flags.dumpsysPolicyEngineMigrationEnabled()).isTrue()
36     }
37 
38     @Test
39     @RequireFlagsDisabled(Flags.FLAG_DUMPSYS_POLICY_ENGINE_MIGRATION_ENABLED)
requireFlagDisabledAnnotation_flagIsDisablednull40     fun requireFlagDisabledAnnotation_flagIsDisabled() {
41         assertThat(Flags.dumpsysPolicyEngineMigrationEnabled()).isFalse()
42     }
43 
44     companion object {
45         @ClassRule @Rule @JvmField
46         val deviceState = DeviceState()
47     }
48 }
49