use of com.microsoft.appcenter.utils.storage.DatabaseManager in project mobile-center-sdk-android by Microsoft.
the class DatabasePersistenceTest method checkSetStorageSizeForwarding.
@Test
public void checkSetStorageSizeForwarding() throws Exception {
/* The real Android test for checking size is in DatabaseManagerAndroidTest. */
DatabaseManager databaseManager = mock(DatabaseManager.class);
whenNew(DatabaseManager.class).withAnyArguments().thenReturn(databaseManager);
when(databaseManager.getCursor(any(SQLiteQueryBuilder.class), any(String[].class), any(String[].class), anyString())).thenReturn(mock(Cursor.class));
when(databaseManager.setMaxSize(anyLong())).thenReturn(true).thenReturn(false);
/* Just checks calls are forwarded to the low level database layer. */
DatabasePersistence persistence = new DatabasePersistence(mock(Context.class));
assertTrue(persistence.setMaxStorageSize(20480));
assertFalse(persistence.setMaxStorageSize(2));
}
Aggregations