@Test
public void suspendSyncAndJournaling() throws Exception {

    Connection connection = null;
    try {
        ConnectionManager connectionManager = temporaryFileDatabase.getConnectionManager(true);
        connection = connectionManager.getConnection(null, noQueryOptions());
        final SQLiteConfig.JournalMode journalMode = DBQueries.getPragmaJournalModeOrNull(connection);
        final SQLiteConfig.SynchronousMode synchronousMode = DBQueries.getPragmaSynchronousOrNull(connection);
        DBQueries.suspendSyncAndJournaling(connection);
        final SQLiteConfig.JournalMode journalModeDisabled = DBQueries.getPragmaJournalModeOrNull(connection);
        final SQLiteConfig.SynchronousMode synchronousModeDisabled = DBQueries.getPragmaSynchronousOrNull(connection);
        Assert.assertEquals(journalModeDisabled, SQLiteConfig.JournalMode.OFF);
        Assert.assertEquals(synchronousModeDisabled, SQLiteConfig.SynchronousMode.OFF);
        DBQueries.setSyncAndJournaling(connection, SQLiteConfig.SynchronousMode.FULL, SQLiteConfig.JournalMode.DELETE);
        final SQLiteConfig.JournalMode journalModeReset = DBQueries.getPragmaJournalModeOrNull(connection);
        final SQLiteConfig.SynchronousMode synchronousModeReset = DBQueries.getPragmaSynchronousOrNull(connection);
        Assert.assertEquals(journalModeReset, journalMode);
        Assert.assertEquals(synchronousModeReset, synchronousMode);
    }finally {
        DBUtils.closeQuietly(connection);
    }
}