@@ -224,7 +224,7 @@ public void getDouble_firebaseAppNotExist_returnsEmpty() {
224
224
}
225
225
226
226
@ Test
227
- public void setValueFloat_setTwice_canGetLatestValue () {
227
+ public void setValueDouble_setTwice_canGetLatestValue () {
228
228
deviceCacheManager .setContext (appContext );
229
229
fakeScheduledExecutorService .runAll ();
230
230
deviceCacheManager .setValue ("some_key" , 1.01 );
@@ -235,13 +235,27 @@ public void setValueFloat_setTwice_canGetLatestValue() {
235
235
}
236
236
237
237
@ Test
238
- public void setValueFloat_contextNotSet_returnsEmpty () {
238
+ public void setValueDouble_wasSetAsFloat_canGetLatestValue () {
239
+ deviceCacheManager .setContext (appContext );
240
+ fakeScheduledExecutorService .runAll ();
241
+
242
+ // Manually setting a Float to simulate it being cached from a previous SDK version.
243
+ SharedPreferences sharedPreferences =
244
+ appContext .getSharedPreferences (Constants .PREFS_NAME , Context .MODE_PRIVATE );
245
+ sharedPreferences .edit ().putFloat ("some_key" , 1.2f ).apply ();
246
+
247
+ deviceCacheManager .setValue ("some_key" , 0.01 );
248
+ assertThat (deviceCacheManager .getDouble ("some_key" ).get ()).isEqualTo (0.01 );
249
+ }
250
+
251
+ @ Test
252
+ public void setValueDouble_contextNotSet_returnsEmpty () {
239
253
deviceCacheManager .setValue ("some_key" , 100.0 );
240
254
assertThat (deviceCacheManager .getDouble ("some_key" ).isAvailable ()).isFalse ();
241
255
}
242
256
243
257
@ Test
244
- public void setValueFloat_keyIsNull_returnsFalse () {
258
+ public void setValueDouble_keyIsNull_returnsFalse () {
245
259
deviceCacheManager .setContext (appContext );
246
260
fakeScheduledExecutorService .runAll ();
247
261
assertThat (deviceCacheManager .setValue (null , 10.0 )).isFalse ();
0 commit comments