mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Update wpilibj to use new NetworkTables package and interfaces.
This may be breaking to CANSpeedController implementations.
This commit is contained in:
@@ -13,11 +13,12 @@ import org.junit.Test;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import edu.wpi.first.networktables.NetworkTable;
|
||||
import edu.wpi.first.networktables.NetworkTableInstance;
|
||||
import edu.wpi.first.wpilibj.Relay.Direction;
|
||||
import edu.wpi.first.wpilibj.Relay.InvalidValueException;
|
||||
import edu.wpi.first.wpilibj.Relay.Value;
|
||||
import edu.wpi.first.wpilibj.fixtures.RelayCrossConnectFixture;
|
||||
import edu.wpi.first.wpilibj.networktables.NetworkTable;
|
||||
import edu.wpi.first.wpilibj.test.AbstractComsSetup;
|
||||
import edu.wpi.first.wpilibj.test.TestBench;
|
||||
|
||||
@@ -30,7 +31,8 @@ import static org.junit.Assert.assertTrue;
|
||||
*/
|
||||
public class RelayCrossConnectTest extends AbstractComsSetup {
|
||||
private static final Logger logger = Logger.getLogger(RelayCrossConnectTest.class.getName());
|
||||
private static final NetworkTable table = NetworkTable.getTable("_RELAY_CROSS_CONNECT_TEST_");
|
||||
private static final NetworkTable table =
|
||||
NetworkTableInstance.getDefault().getTable("_RELAY_CROSS_CONNECT_TEST_");
|
||||
private RelayCrossConnectFixture m_relayFixture;
|
||||
|
||||
|
||||
@@ -57,7 +59,7 @@ public class RelayCrossConnectTest extends AbstractComsSetup {
|
||||
assertTrue("Input two was not high when relay set both high", m_relayFixture.getInputTwo()
|
||||
.get());
|
||||
assertEquals(Value.kOn, m_relayFixture.getRelay().get());
|
||||
assertEquals("On", table.getString("Value", ""));
|
||||
assertEquals("On", table.getEntry("Value").getString(""));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -71,7 +73,7 @@ public class RelayCrossConnectTest extends AbstractComsSetup {
|
||||
.getInputTwo()
|
||||
.get());
|
||||
assertEquals(Value.kForward, m_relayFixture.getRelay().get());
|
||||
assertEquals("Forward", table.getString("Value", ""));
|
||||
assertEquals("Forward", table.getEntry("Value").getString(""));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -85,7 +87,7 @@ public class RelayCrossConnectTest extends AbstractComsSetup {
|
||||
.getInputTwo()
|
||||
.get());
|
||||
assertEquals(Value.kReverse, m_relayFixture.getRelay().get());
|
||||
assertEquals("Reverse", table.getString("Value", ""));
|
||||
assertEquals("Reverse", table.getEntry("Value").getString(""));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -98,7 +100,7 @@ public class RelayCrossConnectTest extends AbstractComsSetup {
|
||||
assertTrue("Input two was not high when relay set Value.kOn in kForward Direction",
|
||||
m_relayFixture.getInputTwo().get());
|
||||
assertEquals(Value.kOn, m_relayFixture.getRelay().get());
|
||||
assertEquals("On", table.getString("Value", ""));
|
||||
assertEquals("On", table.getEntry("Value").getString(""));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -111,7 +113,7 @@ public class RelayCrossConnectTest extends AbstractComsSetup {
|
||||
assertFalse("Input two was not low when relay set Value.kOn in kReverse Direction",
|
||||
m_relayFixture.getInputTwo().get());
|
||||
assertEquals(Value.kOn, m_relayFixture.getRelay().get());
|
||||
assertEquals("On", table.getString("Value", ""));
|
||||
assertEquals("On", table.getEntry("Value").getString(""));
|
||||
}
|
||||
|
||||
@Test(expected = InvalidValueException.class)
|
||||
@@ -132,7 +134,7 @@ public class RelayCrossConnectTest extends AbstractComsSetup {
|
||||
// Initially both outputs should be off
|
||||
assertFalse(m_relayFixture.getInputOne().get());
|
||||
assertFalse(m_relayFixture.getInputTwo().get());
|
||||
assertEquals("Off", table.getString("Value", ""));
|
||||
assertEquals("Off", table.getEntry("Value").getString(""));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user