mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[build] Apply spotless for java formatting (#1768)
Update checkstyle config to be compatible with spotless. Co-authored-by: Austin Shalit <austinshalit@gmail.com>
This commit is contained in:
@@ -4,10 +4,18 @@
|
||||
|
||||
package edu.wpi.first.wpilibj;
|
||||
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import edu.wpi.first.hal.can.CANMessageNotFoundException;
|
||||
import edu.wpi.first.wpilibj.fixtures.MotorEncoderFixture;
|
||||
import edu.wpi.first.wpilibj.test.AbstractComsSetup;
|
||||
import edu.wpi.first.wpilibj.test.TestBench;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
@@ -16,19 +24,7 @@ import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import org.junit.runners.Parameterized.Parameters;
|
||||
|
||||
import edu.wpi.first.hal.can.CANMessageNotFoundException;
|
||||
import edu.wpi.first.wpilibj.fixtures.MotorEncoderFixture;
|
||||
import edu.wpi.first.wpilibj.test.AbstractComsSetup;
|
||||
import edu.wpi.first.wpilibj.test.TestBench;
|
||||
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
/**
|
||||
* Test that covers the {@link PowerDistributionPanel}.
|
||||
*/
|
||||
/** Test that covers the {@link PowerDistributionPanel}. */
|
||||
@RunWith(Parameterized.class)
|
||||
public class PDPTest extends AbstractComsSetup {
|
||||
private static final Logger logger = Logger.getLogger(PDPTest.class.getName());
|
||||
@@ -49,7 +45,6 @@ public class PDPTest extends AbstractComsSetup {
|
||||
me = null;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public PDPTest(MotorEncoderFixture<?> mef, Double expectedCurrentDraw) {
|
||||
logger.fine("Constructor with: " + mef.getType());
|
||||
@@ -65,8 +60,7 @@ public class PDPTest extends AbstractComsSetup {
|
||||
@Parameters(name = "{index}: {0}, Expected Stopped Current Draw: {1}")
|
||||
public static Collection<Object[]> generateData() {
|
||||
// logger.fine("Loading the MotorList");
|
||||
return Arrays.asList(new Object[][]{
|
||||
{TestBench.getInstance().getTalonPair(), 0.0}});
|
||||
return Arrays.asList(new Object[][] {{TestBench.getInstance().getTalonPair(), 0.0}});
|
||||
}
|
||||
|
||||
@After
|
||||
@@ -74,22 +68,20 @@ public class PDPTest extends AbstractComsSetup {
|
||||
me.reset();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test if the current changes when the motor is driven using a talon.
|
||||
*/
|
||||
/** Test if the current changes when the motor is driven using a talon. */
|
||||
@Test
|
||||
public void checkStoppedCurrentForSpeedController() throws CANMessageNotFoundException {
|
||||
Timer.delay(0.25);
|
||||
|
||||
/* The Current should be 0 */
|
||||
assertEquals("The low current was not within the expected range.", m_expectedStoppedCurrentDraw,
|
||||
pdp.getCurrent(me.getPDPChannel()), 0.001);
|
||||
assertEquals(
|
||||
"The low current was not within the expected range.",
|
||||
m_expectedStoppedCurrentDraw,
|
||||
pdp.getCurrent(me.getPDPChannel()),
|
||||
0.001);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the current changes when the motor is driven using a talon.
|
||||
*/
|
||||
/** Test if the current changes when the motor is driven using a talon. */
|
||||
@Test
|
||||
public void checkRunningCurrentForSpeedController() throws CANMessageNotFoundException {
|
||||
/* Set the motor to full forward */
|
||||
@@ -97,8 +89,10 @@ public class PDPTest extends AbstractComsSetup {
|
||||
Timer.delay(2);
|
||||
|
||||
/* The current should now be greater than the low current */
|
||||
assertThat("The driven current is not greater than the resting current.",
|
||||
pdp.getCurrent(me.getPDPChannel()), is(greaterThan(m_expectedStoppedCurrentDraw)));
|
||||
assertThat(
|
||||
"The driven current is not greater than the resting current.",
|
||||
pdp.getCurrent(me.getPDPChannel()),
|
||||
is(greaterThan(m_expectedStoppedCurrentDraw)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user