mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Fix internal deprecation warnings (#4257)
This allows us to error out on deprecation warnings for thirdparty libraries and standard library features. Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
This commit is contained in:
@@ -168,6 +168,7 @@ class CommandDecoratorTest extends CommandTestBase {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal") // Command.perpetually()
|
||||
@Test
|
||||
void perpetuallyTest() {
|
||||
try (CommandScheduler scheduler = new CommandScheduler()) {
|
||||
@@ -184,6 +185,22 @@ class CommandDecoratorTest extends CommandTestBase {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void endlesslyTest() {
|
||||
try (CommandScheduler scheduler = new CommandScheduler()) {
|
||||
Command command = new InstantCommand();
|
||||
|
||||
Command perpetual = command.endlessly();
|
||||
|
||||
scheduler.schedule(perpetual);
|
||||
scheduler.run();
|
||||
scheduler.run();
|
||||
scheduler.run();
|
||||
|
||||
assertTrue(scheduler.isScheduled(perpetual));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void unlessTest() {
|
||||
try (CommandScheduler scheduler = new CommandScheduler()) {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
package edu.wpi.first.wpilibj2.command;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class EndlessCommandTest extends CommandTestBase {
|
||||
@Test
|
||||
void endlessCommandScheduleTest() {
|
||||
try (CommandScheduler scheduler = new CommandScheduler()) {
|
||||
EndlessCommand command = new EndlessCommand(new InstantCommand());
|
||||
|
||||
scheduler.schedule(command);
|
||||
scheduler.run();
|
||||
|
||||
assertTrue(scheduler.isScheduled(command));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,8 +137,8 @@ class ParallelRaceGroupTest extends CommandTestBase {
|
||||
Command command1 = command1Holder.getMock();
|
||||
MockCommandHolder command2Holder = new MockCommandHolder(true, system2);
|
||||
Command command2 = command2Holder.getMock();
|
||||
MockCommandHolder perpetualCommandHolder = new MockCommandHolder(true);
|
||||
Command command3 = new PerpetualCommand(perpetualCommandHolder.getMock());
|
||||
MockCommandHolder endlessCommandHolder = new MockCommandHolder(true);
|
||||
Command command3 = new EndlessCommand(endlessCommandHolder.getMock());
|
||||
|
||||
Command group1 = new SequentialCommandGroup(command1, command2);
|
||||
assertNotNull(group1);
|
||||
|
||||
@@ -9,6 +9,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class PerpetualCommandTest extends CommandTestBase {
|
||||
@SuppressWarnings("removal") // PerpetualCommand
|
||||
@Test
|
||||
void perpetualCommandScheduleTest() {
|
||||
try (CommandScheduler scheduler = new CommandScheduler()) {
|
||||
|
||||
@@ -36,7 +36,7 @@ class ScheduleCommandTest extends CommandTestBase {
|
||||
new SequentialCommandGroup(new InstantCommand(), scheduleCommand);
|
||||
|
||||
scheduler.schedule(group);
|
||||
scheduler.schedule(new InstantCommand().perpetually());
|
||||
scheduler.schedule(new InstantCommand().endlessly());
|
||||
scheduler.run();
|
||||
assertDoesNotThrow(scheduler::run);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user