blob: 13513481643826e13a20bc25a15d116a3ce4ac99 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package com.android.launcher3.config;
import com.android.launcher3.config.FlagOverrideRule.FlagOverride;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* Sample Robolectric test that demonstrates flag-overriding.
*/
@RunWith(RobolectricTestRunner.class)
public class FlagOverrideSampleTest {
// Check out https://junit.org/junit4/javadoc/4.12/org/junit/Rule.html for more information
// on @Rules.
@Rule
public final FlagOverrideRule flags = new FlagOverrideRule();
@FlagOverride(key = "EXAMPLE_FLAG", value = true)
@Test
public void withFlagOn() {
assertTrue(FeatureFlags.EXAMPLE_FLAG.get());
}
@FlagOverride(key = "EXAMPLE_FLAG", value = false)
@Test
public void withFlagOff() {
assertFalse(FeatureFlags.EXAMPLE_FLAG.get());
}
}
|