File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
iterableapi/src/test/java/com/iterable/iterableapi Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -248,4 +248,24 @@ public void testMigrationTimeout() throws InterruptedException {
248248 verify (mockEditor , times (2 )).apply ();
249249 }
250250
251+ @ Test
252+ public void testNullEncryptedPrefs () throws InterruptedException {
253+ // Test behavior when encrypted prefs creation fails
254+ CountDownLatch latch = new CountDownLatch (1 );
255+ AtomicReference <Throwable > error = new AtomicReference <>();
256+
257+ migrator .setMockEncryptedPrefs (null );
258+ migrator .setMigrationCompletionCallback (throwable -> {
259+ error .set (throwable );
260+ latch .countDown ();
261+ return null ;
262+ });
263+
264+ migrator .attemptMigration ();
265+
266+ assertTrue (latch .await (5 , TimeUnit .SECONDS ));
267+ assertNotNull ("Should have received an error" , error .get ());
268+ assertTrue (error .get ().getMessage ().contains ("Failed to create or obtain encrypted preferences" ));
269+ }
270+
251271}
You can’t perform that action at this time.
0 commit comments