Files
build/tools/aconfig/tests/AconfigTest.java
Mårten Kongstad 9c59c31499 aconfig: add Java integration tests
Add integration tests for Java. This test setup verifies that

  - the build system calls aconfig to generate a Java library
  - the Java test compiles against the auto-generated library
  - the auto-generated code returns expected values

Similar integration tests for C++ and Rust will be added in follow-up
CLs.

Note: the build does not currently support specifying that
tests/*.values should be applied, so the test flags will all be assigned
the defaults. A later CL will fix this.

Bug: b/283911467
Test: atest aconfig.test aconfig.test.java
Change-Id: Ia365e209261f4935a23e2dac9ef0ab5b60f76e52
2023-06-09 09:59:21 +02:00

38 lines
1.2 KiB
Java

import static com.android.aconfig.test.Flags.disabled_ro;
import static com.android.aconfig.test.Flags.disabled_rw;
import static com.android.aconfig.test.Flags.enabled_ro;
import static com.android.aconfig.test.Flags.enabled_rw;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public final class AconfigTest {
@Test
public void testDisabledReadOnlyFlag() {
assertFalse(disabled_ro());
}
@Test
public void testEnabledReadOnlyFlag() {
// TODO: change to assertTrue(enabled_ro()) when the build supports reading tests/*.values
// (currently all flags are assigned the default READ_ONLY + DISABLED)
assertFalse(enabled_ro());
}
@Test
public void testDisabledReadWriteFlag() {
assertFalse(disabled_rw());
}
@Test
public void testEnabledReadWriteFlag() {
// TODO: change to assertTrue(enabled_rw()) when the build supports reading tests/*.values
// (currently all flags are assigned the default READ_ONLY + DISABLED)
assertFalse(enabled_rw());
}
}