Applies Google Styleguide to Java parts of the library (#23)

This was partially applied to simulation but
simulation is a bit of a mess and has a lot of duplicated code.
This commit is contained in:
Jonathan Leitschuh
2016-05-20 12:07:40 -04:00
committed by Peter Johnson
parent 64ab6e51fe
commit a834fff7b2
266 changed files with 15574 additions and 14718 deletions

View File

@@ -7,22 +7,23 @@
package edu.wpi.first.wpilibj;
import static org.junit.Assert.*;
import java.util.concurrent.Delayed;
import java.util.logging.Logger;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.logging.Logger;
import edu.wpi.first.wpilibj.test.AbstractComsSetup;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* @author Kacper Puczydlowski
* Test that covers the {@link Compressor}.
*
* @author Kacper Puczydlowski
*/
public class PCMTest extends AbstractComsSetup {
@@ -48,7 +49,8 @@ public class PCMTest extends AbstractComsSetup {
private static DigitalOutput fakePressureSwitch;
private static AnalogInput fakeCompressor;
private static DigitalInput fakeSolenoid1, fakeSolenoid2;
private static DigitalInput fakeSolenoid1;
private static DigitalInput fakeSolenoid2;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
@@ -72,24 +74,18 @@ public class PCMTest extends AbstractComsSetup {
fakeSolenoid2.free();
}
@Before
public void setUp() throws Exception {}
@Before
public void reset() throws Exception {
compressor.stop();
fakePressureSwitch.set(false);
}
@After
public void tearDown() throws Exception {}
/**
* Test if the compressor turns on and off when the pressure switch is toggled
* Test if the compressor turns on and off when the pressure switch is toggled.
*/
@Test
public void testPressureSwitch() throws Exception {
double range = 0.5;
final double range = 0.1;
reset();
compressor.setClosedLoopControl(true);
@@ -107,7 +103,7 @@ public class PCMTest extends AbstractComsSetup {
}
/**
* Test if the correct solenoids turn on and off when they should
* Test if the correct solenoids turn on and off when they should.
*/
@Test
public void testSolenoid() throws Exception {
@@ -156,8 +152,8 @@ public class PCMTest extends AbstractComsSetup {
}
/**
* Test if the correct solenoids turn on and off when they should when used
* with the DoubleSolenoid class.
* Test if the correct solenoids turn on and off when they should when used with the
* DoubleSolenoid class.
*/
@Test
public void doubleSolenoid() {
@@ -173,13 +169,15 @@ public class PCMTest extends AbstractComsSetup {
Timer.delay(kSolenoidDelayTime);
assertFalse("Solenoid #1 did not turn on", fakeSolenoid1.get());
assertTrue("Solenoid #2 did not turn off", fakeSolenoid2.get());
assertTrue("DoubleSolenoid did not report Forward", (solenoid.get() == DoubleSolenoid.Value.kForward));
assertTrue("DoubleSolenoid did not report Forward", (solenoid.get() == DoubleSolenoid.Value
.kForward));
solenoid.set(DoubleSolenoid.Value.kReverse);
Timer.delay(kSolenoidDelayTime);
assertTrue("Solenoid #1 did not turn off", fakeSolenoid1.get());
assertFalse("Solenoid #2 did not turn on", fakeSolenoid2.get());
assertTrue("DoubleSolenoid did not report Reverse", (solenoid.get() == DoubleSolenoid.Value.kReverse));
assertTrue("DoubleSolenoid did not report Reverse", (solenoid.get() == DoubleSolenoid.Value
.kReverse));
solenoid.free();
}