Skip to content

Commit 3412df8

Browse files
committed
[MOB-9235] Cleanup
1 parent e63b937 commit 3412df8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

iterableapi/src/test/java/com/iterable/iterableapi/IterableKeychainEncryptedDataMigratorTest.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)