Skip to content

Commit

Permalink
FIx unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
viggy96 committed Jun 27, 2024
1 parent 6a84ab6 commit 0b038fc
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/test/java/frc/robot/subsystems/ShooterSubsystemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.mockito.ArgumentMatchers;

import com.revrobotics.CANSparkBase.ControlType;
import com.revrobotics.SparkPIDController.ArbFFUnits;

import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.units.Angle;
Expand Down Expand Up @@ -114,7 +115,9 @@ public void setState() {
verify(m_topFlywheelMotor, times(1)).set(AdditionalMatchers.eq(state.speed.in(Units.MetersPerSecond), DELTA), ArgumentMatchers.eq(ControlType.kVelocity));
verify(m_angleMotor, times(1)).set(
AdditionalMatchers.eq(state.angle.in(Units.Radians), DELTA),
ArgumentMatchers.eq(ControlType.kPosition)
ArgumentMatchers.eq(ControlType.kPosition),
ArgumentMatchers.anyDouble(),
ArgumentMatchers.eq(ArbFFUnits.kVoltage)
);
}

Expand All @@ -137,7 +140,9 @@ public void setHighAngle() {
verify(m_topFlywheelMotor, times(1)).set(AdditionalMatchers.eq(state.speed.in(Units.MetersPerSecond), DELTA), ArgumentMatchers.eq(ControlType.kVelocity));
verify(m_angleMotor, times(1)).set(
AdditionalMatchers.eq(Constants.Shooter.ANGLE_CONFIG.getUpperLimit(), DELTA),
ArgumentMatchers.eq(ControlType.kPosition)
ArgumentMatchers.eq(ControlType.kPosition),
ArgumentMatchers.anyDouble(),
ArgumentMatchers.eq(ArbFFUnits.kVoltage)
);
}

Expand All @@ -160,7 +165,9 @@ public void setLowAngle() {
verify(m_topFlywheelMotor, times(1)).set(AdditionalMatchers.eq(state.speed.in(Units.MetersPerSecond), DELTA), ArgumentMatchers.eq(ControlType.kVelocity));
verify(m_angleMotor, times(1)).set(
AdditionalMatchers.eq(Constants.Shooter.ANGLE_CONFIG.getLowerLimit(), DELTA),
ArgumentMatchers.eq(ControlType.kPosition)
ArgumentMatchers.eq(ControlType.kPosition),
ArgumentMatchers.anyDouble(),
ArgumentMatchers.eq(ArbFFUnits.kVoltage)
);
}

Expand Down

0 comments on commit 0b038fc

Please sign in to comment.