@Test
public void testInit_ApplyUpdateForIndexIsFalse() throws Exception{

    ConnectionManager connectionManager = mock(ConnectionManager.class);
    Connection connection = mock(Connection.class);
    when(connectionManager.getConnection(any(SQLiteIndex.class), anyQueryOptions())).thenReturn(connection);
    // Simulate isApplyUpdateForIndexEnabled == false...
    when(connectionManager.isApplyUpdateForIndexEnabled(any(SQLiteIndex.class))).thenReturn(false);
    Statement statement = mock(Statement.class);
    when(connection.createStatement()).thenReturn(statement);
    java.sql.ResultSet journalModeRs = mock(java.sql.ResultSet.class);
    java.sql.ResultSet synchronousRs = mock(java.sql.ResultSet.class);
    when(journalModeRs.next()).thenReturn(true).thenReturn(false);
    when(synchronousRs.next()).thenReturn(true).thenReturn(false);
    when(journalModeRs.getString(1)).thenReturn("DELETE");
    when(synchronousRs.getInt(1)).thenReturn(2);
    when(statement.executeQuery("PRAGMA journal_mode;")).thenReturn(journalModeRs);
    when(statement.executeQuery("PRAGMA synchronous;")).thenReturn(synchronousRs);
    SQLiteIndex<String, Car, Integer> carFeaturesOffHeapIndex = new SQLiteIndex<String, Car, Integer>(
            Car.FEATURES,
            OBJECT_TO_ID,
            ID_TO_OBJECT,
            ""
    );
    carFeaturesOffHeapIndex.init(emptyObjectStore(), createQueryOptions(connectionManager));
    verify(statement, times(1)).executeQuery("PRAGMA journal_mode;");
    verify(statement, times(1)).executeQuery("PRAGMA synchronous;");
    verify(statement, times(2)).close();
    Assert.assertEquals(carFeaturesOffHeapIndex.pragmaSynchronous, SQLiteConfig.SynchronousMode.FULL);
    Assert.assertEquals(carFeaturesOffHeapIndex.pragmaJournalMode, SQLiteConfig.JournalMode.DELETE);
    Assert.assertTrue(carFeaturesOffHeapIndex.canModifySyncAndJournaling);
}