Mårten Kongstad | af3da9d | 2023-07-24 11:10:00 +0200 | [diff] [blame^] | 1 | import static com.android.aconfig.test.Flags.FLAG_DISABLED_RO; |
| 2 | import static com.android.aconfig.test.Flags.FLAG_DISABLED_RW; |
| 3 | import static com.android.aconfig.test.Flags.FLAG_ENABLED_RO; |
| 4 | import static com.android.aconfig.test.Flags.FLAG_ENABLED_RW; |
Zhi Dou | af81e20 | 2023-06-14 20:38:20 +0000 | [diff] [blame] | 5 | import static com.android.aconfig.test.Flags.disabledRo; |
| 6 | import static com.android.aconfig.test.Flags.disabledRw; |
| 7 | import static com.android.aconfig.test.Flags.enabledRo; |
| 8 | import static com.android.aconfig.test.Flags.enabledRw; |
Mårten Kongstad | af3da9d | 2023-07-24 11:10:00 +0200 | [diff] [blame^] | 9 | import static org.junit.Assert.assertEquals; |
Mårten Kongstad | 9c59c31 | 2023-05-30 11:15:02 +0200 | [diff] [blame] | 10 | import static org.junit.Assert.assertFalse; |
| 11 | import static org.junit.Assert.assertTrue; |
| 12 | |
| 13 | import org.junit.Test; |
| 14 | import org.junit.runner.RunWith; |
| 15 | import org.junit.runners.JUnit4; |
| 16 | |
| 17 | @RunWith(JUnit4.class) |
| 18 | public final class AconfigTest { |
| 19 | @Test |
| 20 | public void testDisabledReadOnlyFlag() { |
Mårten Kongstad | af3da9d | 2023-07-24 11:10:00 +0200 | [diff] [blame^] | 21 | assertEquals("com.android.aconfig.test.disabled_ro", FLAG_DISABLED_RO); |
Zhi Dou | af81e20 | 2023-06-14 20:38:20 +0000 | [diff] [blame] | 22 | assertFalse(disabledRo()); |
Mårten Kongstad | 9c59c31 | 2023-05-30 11:15:02 +0200 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | @Test |
| 26 | public void testEnabledReadOnlyFlag() { |
Mårten Kongstad | af3da9d | 2023-07-24 11:10:00 +0200 | [diff] [blame^] | 27 | assertEquals("com.android.aconfig.test.disabled_rw", FLAG_DISABLED_RW); |
Zhi Dou | af81e20 | 2023-06-14 20:38:20 +0000 | [diff] [blame] | 28 | // TODO: change to assertTrue(enabledRo()) when the build supports reading tests/*.values |
Mårten Kongstad | 9c59c31 | 2023-05-30 11:15:02 +0200 | [diff] [blame] | 29 | // (currently all flags are assigned the default READ_ONLY + DISABLED) |
Zhi Dou | af81e20 | 2023-06-14 20:38:20 +0000 | [diff] [blame] | 30 | assertFalse(enabledRo()); |
Mårten Kongstad | 9c59c31 | 2023-05-30 11:15:02 +0200 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | @Test |
| 34 | public void testDisabledReadWriteFlag() { |
Mårten Kongstad | af3da9d | 2023-07-24 11:10:00 +0200 | [diff] [blame^] | 35 | assertEquals("com.android.aconfig.test.enabled_ro", FLAG_ENABLED_RO); |
Zhi Dou | af81e20 | 2023-06-14 20:38:20 +0000 | [diff] [blame] | 36 | assertFalse(disabledRw()); |
Mårten Kongstad | 9c59c31 | 2023-05-30 11:15:02 +0200 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | @Test |
| 40 | public void testEnabledReadWriteFlag() { |
Mårten Kongstad | af3da9d | 2023-07-24 11:10:00 +0200 | [diff] [blame^] | 41 | assertEquals("com.android.aconfig.test.enabled_rw", FLAG_ENABLED_RW); |
Zhi Dou | af81e20 | 2023-06-14 20:38:20 +0000 | [diff] [blame] | 42 | // TODO: change to assertTrue(enabledRw()) when the build supports reading tests/*.values |
Mårten Kongstad | 9c59c31 | 2023-05-30 11:15:02 +0200 | [diff] [blame] | 43 | // (currently all flags are assigned the default READ_ONLY + DISABLED) |
Zhi Dou | af81e20 | 2023-06-14 20:38:20 +0000 | [diff] [blame] | 44 | assertFalse(enabledRw()); |
Mårten Kongstad | 9c59c31 | 2023-05-30 11:15:02 +0200 | [diff] [blame] | 45 | } |
| 46 | } |