1 /*
2  * Copyright (C) 2023 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.systemui.smartspace
18 
19 import android.testing.AndroidTestingRunner
20 import androidx.test.filters.SmallTest
21 import com.android.systemui.SysuiTestCase
22 import com.android.systemui.flags.FeatureFlags
23 import com.android.systemui.flags.Flags
24 import com.android.systemui.smartspace.config.BcSmartspaceConfigProvider
25 import com.android.systemui.util.mockito.whenever
26 import junit.framework.Assert.assertFalse
27 import junit.framework.Assert.assertTrue
28 import org.junit.Before
29 import org.junit.Test
30 import org.junit.runner.RunWith
31 import org.mockito.Mock
32 import org.mockito.MockitoAnnotations
33 
34 @SmallTest
35 @RunWith(AndroidTestingRunner::class)
36 class BcSmartspaceConfigProviderTest : SysuiTestCase() {
37     @Mock private lateinit var featureFlags: FeatureFlags
38 
39     private lateinit var configProvider: BcSmartspaceConfigProvider
40 
41     @Before
42     fun setUp() {
43         MockitoAnnotations.initMocks(this)
44         configProvider = BcSmartspaceConfigProvider(featureFlags)
45     }
46 
47     @Test
48     fun isDefaultDateWeatherDisabled_flagIsTrue_returnsTrue() {
49         whenever(featureFlags.isEnabled(Flags.SMARTSPACE_DATE_WEATHER_DECOUPLED)).thenReturn(true)
50 
51         assertTrue(configProvider.isDefaultDateWeatherDisabled)
52     }
53 
54     @Test
55     fun isDefaultDateWeatherDisabled_flagIsFalse_returnsFalse() {
56         whenever(featureFlags.isEnabled(Flags.SMARTSPACE_DATE_WEATHER_DECOUPLED)).thenReturn(false)
57 
58         assertFalse(configProvider.isDefaultDateWeatherDisabled)
59     }
60 }
61