aconfig: change java flag method name to camelCase

Before java code will directly use the flag name as the method name.
This change adds funciton to try the best to convert flag name to
camelCase, and then use the camelCase string as the method name in the
generated code.

Bug: 279483816
Test: atest aconfig.test aconfig.test.java
Change-Id: I45fc6df46c9d535cd38a657a41313202f9b660af
This commit is contained in:
Zhi Dou
2023-06-14 20:38:20 +00:00
parent e4635b3e04
commit af81e20653
2 changed files with 51 additions and 27 deletions

View File

@@ -1,7 +1,7 @@
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 com.android.aconfig.test.Flags.disabledRo;
import static com.android.aconfig.test.Flags.disabledRw;
import static com.android.aconfig.test.Flags.enabledRo;
import static com.android.aconfig.test.Flags.enabledRw;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -13,25 +13,25 @@ import org.junit.runners.JUnit4;
public final class AconfigTest {
@Test
public void testDisabledReadOnlyFlag() {
assertFalse(disabled_ro());
assertFalse(disabledRo());
}
@Test
public void testEnabledReadOnlyFlag() {
// TODO: change to assertTrue(enabled_ro()) when the build supports reading tests/*.values
// TODO: change to assertTrue(enabledRo()) when the build supports reading tests/*.values
// (currently all flags are assigned the default READ_ONLY + DISABLED)
assertFalse(enabled_ro());
assertFalse(enabledRo());
}
@Test
public void testDisabledReadWriteFlag() {
assertFalse(disabled_rw());
assertFalse(disabledRw());
}
@Test
public void testEnabledReadWriteFlag() {
// TODO: change to assertTrue(enabled_rw()) when the build supports reading tests/*.values
// TODO: change to assertTrue(enabledRw()) when the build supports reading tests/*.values
// (currently all flags are assigned the default READ_ONLY + DISABLED)
assertFalse(enabled_rw());
assertFalse(enabledRw());
}
}