2020-12-26 14:12:05 -08:00
|
|
|
// 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.
|
2016-01-02 03:02:34 -08:00
|
|
|
|
2014-05-13 07:53:00 -04:00
|
|
|
package edu.wpi.first.wpilibj;
|
|
|
|
|
|
2020-12-29 22:45:16 -08:00
|
|
|
import static org.junit.Assert.assertTrue;
|
2018-05-24 00:31:04 -04:00
|
|
|
|
2020-12-29 22:45:16 -08:00
|
|
|
import edu.wpi.first.wpilibj.fixtures.SampleFixture;
|
|
|
|
|
import edu.wpi.first.wpilibj.test.AbstractComsSetup;
|
|
|
|
|
import java.util.logging.Logger;
|
2014-05-13 07:53:00 -04:00
|
|
|
import org.junit.AfterClass;
|
|
|
|
|
import org.junit.Before;
|
|
|
|
|
import org.junit.BeforeClass;
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
|
|
/**
|
2016-05-20 12:07:40 -04:00
|
|
|
* Sample test for a sample PID controller. This demonstrates the general pattern of how to create a
|
|
|
|
|
* test and use testing fixtures and categories. All tests must extend from {@link
|
|
|
|
|
* AbstractComsSetup} in order to ensure that Network Communications are set up before the tests are
|
|
|
|
|
* run.
|
2014-05-13 07:53:00 -04:00
|
|
|
*/
|
|
|
|
|
public class SampleTest extends AbstractComsSetup {
|
2015-06-25 15:07:55 -04:00
|
|
|
private static final Logger logger = Logger.getLogger(SampleTest.class.getName());
|
2014-05-13 07:53:00 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
static SampleFixture fixture = new SampleFixture();
|
2014-05-13 07:53:00 -04:00
|
|
|
|
2018-06-03 10:00:53 -07:00
|
|
|
@Override
|
2015-06-25 15:07:55 -04:00
|
|
|
protected Logger getClassLogger() {
|
|
|
|
|
return logger;
|
|
|
|
|
}
|
2014-05-13 07:53:00 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
@BeforeClass
|
|
|
|
|
public static void classSetup() {
|
|
|
|
|
// Set up the fixture before the test is created
|
|
|
|
|
fixture.setup();
|
|
|
|
|
}
|
2014-05-13 07:53:00 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
@Before
|
|
|
|
|
public void setUp() {
|
|
|
|
|
// Reset the fixture elements before every test
|
|
|
|
|
fixture.reset();
|
|
|
|
|
}
|
2014-05-13 07:53:00 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
@AfterClass
|
|
|
|
|
public static void tearDown() {
|
|
|
|
|
// Clean up the fixture after the test
|
|
|
|
|
fixture.teardown();
|
|
|
|
|
}
|
2014-05-13 07:53:00 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
/**
|
2016-05-20 12:07:40 -04:00
|
|
|
* This is just a sample test that asserts true. Any traditional junit code can be used, these are
|
|
|
|
|
* ordinary junit tests!
|
2015-06-25 15:07:55 -04:00
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void test() {
|
2014-11-17 16:02:41 -05:00
|
|
|
Timer.delay(0.5);
|
2015-06-25 15:07:55 -04:00
|
|
|
assertTrue(true);
|
|
|
|
|
}
|
2014-05-13 07:53:00 -04:00
|
|
|
}
|