[wpilibj] Add Preferences.getNetworkTable() (#7962)

This commit is contained in:
Kevin Cooney
2025-06-16 20:22:11 -07:00
committed by GitHub
parent 057f5ddf81
commit c655b7a893
2 changed files with 16 additions and 0 deletions

View File

@@ -97,6 +97,15 @@ public final class Preferences {
});
}
/**
* Gets the network table used for preferences entries.
*
* @return the network table used for preferences entries
*/
public static NetworkTable getNetworkTable() {
return m_table;
}
/**
* Gets the preferences keys.
*

View File

@@ -91,6 +91,13 @@ class PreferencesTest {
"Preferences was not empty! Preferences in table: " + Arrays.toString(keys.toArray()));
}
@Test
void getNetworkTableTest() {
NetworkTable networkTable = Preferences.getNetworkTable();
assertEquals(m_table, networkTable);
}
@ParameterizedTest
@MethodSource("defaultKeyProvider")
void defaultKeysTest(String key) {