[wpilib] Fixup alerts (#8663)

Makes Java `Alert.Level.ERROR`, `Alert.Level.WARNING`, and
`Alert.Level.INFO` proper aliases (instead of separate enum constants
with the same value).
Cleans up Python tests.
Makes the Alert tests more consistent between languages.
This commit is contained in:
Joseph Eng
2026-03-09 23:03:00 -07:00
committed by GitHub
parent c0f8159540
commit f196418297
5 changed files with 64 additions and 51 deletions

View File

@@ -54,19 +54,20 @@ class AlertSimTest {
}
@Test
void testInitialization() {
void testNoAlertsInitially() {
assertEquals(0, AlertSim.getCount());
assertEquals(0, AlertSim.getAll().length);
}
@Test
void testReset() {
void testNoAlertsAfterReset() {
try (var alert = makeAlert("alert", Level.HIGH)) {
alert.set(true);
assertTrue(isAlertActive("alert", Level.HIGH));
AlertSim.resetData();
assertEquals(0, AlertSim.getCount());
assertEquals(0, AlertSim.getAll().length);
}
AlertSim.resetData();
assertFalse(isAlertActive("alert", Level.HIGH));
}
@Test
@@ -109,6 +110,7 @@ class AlertSimTest {
c.set(true);
var startState = List.of(getActiveAlerts(Level.LOW));
assertEquals(List.of("A", "B", "C"), startState);
b.set(true);
assertState(Level.LOW, startState);