mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
Always statically import JUnit Assertions
This commit is contained in:
@@ -46,7 +46,6 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -95,7 +94,7 @@ class PhotonCameraTest {
|
||||
|
||||
@Test
|
||||
public void testEmpty() {
|
||||
Assertions.assertDoesNotThrow(
|
||||
assertDoesNotThrow(
|
||||
() -> {
|
||||
var packet = new Packet(1);
|
||||
var ret = new PhotonPipelineResult();
|
||||
|
||||
@@ -24,9 +24,10 @@
|
||||
|
||||
package org.photonvision;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import edu.wpi.first.math.geometry.*;
|
||||
import edu.wpi.first.math.util.Units;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class PhotonUtilTest {
|
||||
@@ -40,7 +41,7 @@ class PhotonUtilTest {
|
||||
var dist =
|
||||
PhotonUtils.calculateDistanceToTargetMeters(camHeight, targetHeight, camPitch, targetPitch);
|
||||
|
||||
Assertions.assertEquals(3.464, dist, 0.01);
|
||||
assertEquals(3.464, dist, 0.01);
|
||||
|
||||
camHeight = 1;
|
||||
targetHeight = 2;
|
||||
@@ -49,7 +50,7 @@ class PhotonUtilTest {
|
||||
|
||||
dist =
|
||||
PhotonUtils.calculateDistanceToTargetMeters(camHeight, targetHeight, camPitch, targetPitch);
|
||||
Assertions.assertEquals(5.671, dist, 0.01);
|
||||
assertEquals(5.671, dist, 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -75,9 +76,9 @@ class PhotonUtilTest {
|
||||
fieldToTarget,
|
||||
cameraToRobot);
|
||||
|
||||
Assertions.assertEquals(-3.464, fieldToRobot.getX(), 0.1);
|
||||
Assertions.assertEquals(0, fieldToRobot.getY(), 0.1);
|
||||
Assertions.assertEquals(0, fieldToRobot.getRotation().getDegrees(), 0.1);
|
||||
assertEquals(-3.464, fieldToRobot.getX(), 0.1);
|
||||
assertEquals(0, fieldToRobot.getY(), 0.1);
|
||||
assertEquals(0, fieldToRobot.getRotation().getDegrees(), 0.1);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -94,8 +95,8 @@ class PhotonUtilTest {
|
||||
new Translation2d(Units.inchesToMeters(324), Units.inchesToMeters(162)),
|
||||
new Rotation2d());
|
||||
var currentPose = new Pose2d(0, 0, Rotation2d.fromDegrees(0));
|
||||
Assertions.assertEquals(4.0, fieldToRobot.getX());
|
||||
Assertions.assertEquals(
|
||||
assertEquals(4.0, fieldToRobot.getX());
|
||||
assertEquals(
|
||||
Math.toDegrees(Math.atan2((Units.inchesToMeters(162)), (Units.inchesToMeters(324)))),
|
||||
PhotonUtils.getYawToPose(currentPose, targetPose).getDegrees());
|
||||
}
|
||||
|
||||
@@ -25,10 +25,11 @@
|
||||
package org.photonvision;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class PhotonVersionTest {
|
||||
@@ -52,11 +53,11 @@ public class PhotonVersionTest {
|
||||
|
||||
@Test
|
||||
public void testVersion() {
|
||||
Assertions.assertTrue(versionMatches("v2021.1.6", "v2021.1.6"));
|
||||
Assertions.assertTrue(versionMatches("dev-v2021.1.6", "v2021.1.6"));
|
||||
Assertions.assertTrue(versionMatches("dev-v2021.1.6-5-gca49ea50", "v2021.1.6"));
|
||||
Assertions.assertFalse(versionMatches("", "v2021.1.6"));
|
||||
Assertions.assertFalse(versionMatches("v2021.1.6", ""));
|
||||
assertTrue(versionMatches("v2021.1.6", "v2021.1.6"));
|
||||
assertTrue(versionMatches("dev-v2021.1.6", "v2021.1.6"));
|
||||
assertTrue(versionMatches("dev-v2021.1.6-5-gca49ea50", "v2021.1.6"));
|
||||
assertFalse(versionMatches("", "v2021.1.6"));
|
||||
assertFalse(versionMatches("v2021.1.6", ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
package org.photonvision;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
@@ -50,7 +51,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -111,7 +111,7 @@ class VisionSystemSimTest {
|
||||
|
||||
@Test
|
||||
public void testEmpty() {
|
||||
Assertions.assertDoesNotThrow(
|
||||
assertDoesNotThrow(
|
||||
() -> {
|
||||
var sysUnderTest = new VisionSystemSim("Test");
|
||||
sysUnderTest.addVisionTargets(
|
||||
|
||||
Reference in New Issue
Block a user