Skip to content

Commit

Permalink
fix #35
Browse files Browse the repository at this point in the history
  • Loading branch information
CoolSpy3 committed Apr 1, 2023
1 parent faceac6 commit ba9c4dc
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.revrobotics.CANSparkMax;
import com.revrobotics.RelativeEncoder;
import com.revrobotics.SparkMaxAbsoluteEncoder;
import com.revrobotics.SparkMaxAnalogSensor;
import com.revrobotics.SparkMaxLimitSwitch;
import com.revrobotics.SparkMaxPIDController;
Expand All @@ -23,6 +24,8 @@ public class DummySparkMaxAnswer extends REVLibErrorAnswer {
public static final SparkMaxAnalogSensor DUMMY_ANALOG_SENSOR = Mocks.mock(SparkMaxAnalogSensor.class, REVLibErrorAnswer.ANSWER);
public static final SparkMaxLimitSwitch DUMMY_LIMIT_SWITCH = Mocks.mock(SparkMaxLimitSwitch.class, REVLibErrorAnswer.ANSWER);
public static final SparkMaxPIDController DUMMY_PID_CONTROLLER = Mocks.mock(SparkMaxPIDController.class, ANSWER);
public static final SparkMaxAbsoluteEncoder DUMMY_ABSOLUTE_ENCODER = Mocks.mock(SparkMaxAbsoluteEncoder.class, ANSWER);


@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
Expand All @@ -41,6 +44,8 @@ public Object answer(InvocationOnMock invocation) throws Throwable {
return IdleMode.kBrake;
} else if(returnType == AccelStrategy.class) {
return AccelStrategy.kTrapezoidal;
} else if(returnType == SparkMaxAbsoluteEncoder.class) {
return DUMMY_ABSOLUTE_ENCODER;
}
return super.answer(invocation);
}
Expand Down

0 comments on commit ba9c4dc

Please sign in to comment.