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 17 package com.android.healthfitness.flags; 18 19 import static com.google.common.truth.Truth.assertThat; 20 21 import android.platform.test.annotations.DisableFlags; 22 import android.platform.test.annotations.EnableFlags; 23 import android.platform.test.flag.junit.SetFlagsRule; 24 25 import org.junit.Rule; 26 import org.junit.Test; 27 28 public class AconfigFeatureFlagHelperTest { 29 @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); 30 31 @Test 32 @EnableFlags({Flags.FLAG_PERSONAL_HEALTH_RECORD_DATABASE, Flags.FLAG_PERSONAL_HEALTH_RECORD}) phr_featureFlagTrueAndDbFlagTrue_expectTrue()33 public void phr_featureFlagTrueAndDbFlagTrue_expectTrue() { 34 assertThat(AconfigFeatureFlagHelper.isPersonalHealthRecordEnabled()).isTrue(); 35 } 36 37 @Test 38 @DisableFlags({Flags.FLAG_PERSONAL_HEALTH_RECORD_DATABASE, Flags.FLAG_PERSONAL_HEALTH_RECORD}) phr_featureFlagFalseAndDbFlagFalse_expectFalse()39 public void phr_featureFlagFalseAndDbFlagFalse_expectFalse() { 40 assertThat(AconfigFeatureFlagHelper.isPersonalHealthRecordEnabled()).isFalse(); 41 } 42 43 @Test 44 @DisableFlags(Flags.FLAG_PERSONAL_HEALTH_RECORD) 45 @EnableFlags(Flags.FLAG_PERSONAL_HEALTH_RECORD_DATABASE) phr_featureFlagFalseAndDbTrue_expectFalse()46 public void phr_featureFlagFalseAndDbTrue_expectFalse() { 47 assertThat(AconfigFeatureFlagHelper.isPersonalHealthRecordEnabled()).isFalse(); 48 } 49 50 @Test 51 @EnableFlags(Flags.FLAG_PERSONAL_HEALTH_RECORD) 52 @DisableFlags(Flags.FLAG_PERSONAL_HEALTH_RECORD_DATABASE) phr_featureFlagTrueAndDbFalse_expectFalse()53 public void phr_featureFlagTrueAndDbFalse_expectFalse() { 54 assertThat(AconfigFeatureFlagHelper.isPersonalHealthRecordEnabled()).isFalse(); 55 } 56 } 57