@@ -84,7 +84,7 @@ void resetDriveEncoder() {
8484
8585 @ Nested
8686 @ DisplayName ("When setting azimuth zero" )
87- class WhenSettingAzimuthZero {
87+ class TestWhenSettingAzimuthZero {
8888
8989 TalonSRX azimuthTalon ;
9090 TalonFX driveTalon ;
@@ -119,39 +119,37 @@ void storeAzimuthZeroReference() {
119119 .wheelDiameterInches (kWheelDiameterInches )
120120 .driveMaximumMetersPerSecond (kMaxSpeedMetersPerSecond );
121121
122- Preferences preferences = Preferences .getInstance ();
123-
124122 int expectedZeroReference = 27 ;
125123 int index = 0 ; // fixture wheel is LF
126124 String key = String .format ("SwerveDrive/wheel.%d" , index );
127125 module = builder .wheelLocationMeters (new Translation2d (1 , 1 )).build ();
128126 when (sensorCollection .getPulseWidthPosition ()).thenReturn (expectedZeroReference );
129127 module .storeAzimuthZeroReference ();
130- assertEquals (expectedZeroReference , preferences .getInt (key , -1 ));
128+ assertEquals (expectedZeroReference , Preferences .getInt (key , -1 ));
131129
132130 expectedZeroReference = 67 ;
133131 index = 1 ; // fixture wheel is RF
134132 key = String .format ("SwerveDrive/wheel.%d" , index );
135133 module = builder .wheelLocationMeters (new Translation2d (1 , -1 )).build ();
136134 when (sensorCollection .getPulseWidthPosition ()).thenReturn (expectedZeroReference );
137135 module .storeAzimuthZeroReference ();
138- assertEquals (expectedZeroReference , preferences .getInt (key , -1 ));
136+ assertEquals (expectedZeroReference , Preferences .getInt (key , -1 ));
139137
140138 expectedZeroReference = 2767 ;
141139 index = 2 ; // fixture wheel is LR
142140 key = String .format ("SwerveDrive/wheel.%d" , index );
143141 module = builder .wheelLocationMeters (new Translation2d (-1 , 1 )).build ();
144142 when (sensorCollection .getPulseWidthPosition ()).thenReturn (expectedZeroReference );
145143 module .storeAzimuthZeroReference ();
146- assertEquals (expectedZeroReference , preferences .getInt (key , -1 ));
144+ assertEquals (expectedZeroReference , Preferences .getInt (key , -1 ));
147145
148146 expectedZeroReference = 6727 ;
149147 index = 3 ; // fixture wheel is RR
150148 key = String .format ("SwerveDrive/wheel.%d" , index );
151149 module = builder .wheelLocationMeters (new Translation2d (-1 , -1 )).build ();
152150 when (sensorCollection .getPulseWidthPosition ()).thenReturn (expectedZeroReference );
153151 module .storeAzimuthZeroReference ();
154- assertEquals (expectedZeroReference & 0xFFF , preferences .getInt (key , -1 ));
152+ assertEquals (expectedZeroReference & 0xFFF , Preferences .getInt (key , -1 ));
155153 }
156154
157155 @ ParameterizedTest
@@ -160,8 +158,7 @@ void storeAzimuthZeroReference() {
160158 void shouldSetAzimuthZero (int absoluteEncoderPosition , int zeroReference , double setpoint ) {
161159 int index = 0 ; // fixture wheel is LF
162160 String key = String .format ("SwerveDrive/wheel.%d" , index );
163- Preferences preferences = Preferences .getInstance ();
164- preferences .putInt (key , zeroReference );
161+ Preferences .setInt (key , zeroReference );
165162 when (sensorCollection .getPulseWidthPosition ()).thenReturn (absoluteEncoderPosition );
166163 when (azimuthTalon .setSelectedSensorPosition (eq (setpoint ), anyInt (), anyInt ()))
167164 .thenReturn (ErrorCode .valueOf (0 ));
@@ -174,9 +171,8 @@ void shouldSetAzimuthZero(int absoluteEncoderPosition, int zeroReference, double
174171 void shouldThrowExceptionIfNoNetworkTablesReference () {
175172 int index = 0 ; // fixture wheel is LF
176173 String key = String .format ("SwerveDrive/wheel.%d" , index );
177- Preferences preferences = Preferences .getInstance ();
178- preferences .remove (key );
179- int reference = preferences .getInt (key , Integer .MIN_VALUE );
174+ Preferences .remove (key );
175+ int reference = Preferences .getInt (key , Integer .MIN_VALUE );
180176 assertEquals (Integer .MIN_VALUE , reference );
181177
182178 when (sensorCollection .getPulseWidthPosition ()).thenReturn (0 );
@@ -219,7 +215,7 @@ void rotation2DShouldWorkAsExpected() {
219215
220216 @ Nested
221217 @ DisplayName ("Should not validate" )
222- class ShouldNotValidate {
218+ class TestShouldNotValidate {
223219
224220 private TalonSRX azimuthTalon ;
225221 private TalonFX driveTalon ;
@@ -301,7 +297,7 @@ void whenWheelLocationNotSet() {
301297
302298 @ Nested
303299 @ DisplayName ("Should get module state" )
304- class ShouldGetModuleState {
300+ class TestShouldGetModuleState {
305301
306302 private TalonSRX azimuthTalon ;
307303 private TalonFX driveTalon ;
@@ -451,7 +447,7 @@ void getWheelLocationMeters() {
451447
452448 @ Nested
453449 @ DisplayName ("Should set module state" )
454- class ShouldSetModuleState {
450+ class TestShouldSetModuleState {
455451
456452 final ArgumentCaptor <Double > captor = ArgumentCaptor .forClass (Double .class );
457453 private TalonSRX azimuthTalon ;
0 commit comments