package io.requery.test;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import io.requery.android.sqlite.DatabaseSource;
import io.requery.meta.EntityModel;
import io.requery.sql.EntityDataStore;
import io.requery.test.model.Models;
import org.junit.runner.RunWith;

import java.sql.SQLException;

/**
 * Reuses the core functional tests from the test project
 */
@RunWith(AndroidJUnit4.class)
public class AndroidFunctionalTest extends FunctionalTest {

    @Override
    public void setup() throws SQLException {
        Context context = InstrumentationRegistry.getContext();
        final String dbName = "test.db";
        context.deleteDatabase(dbName);
        EntityModel model = Models.DEFAULT;
        DatabaseSource dataSource = new DatabaseSource(context, model, dbName, 1);
        dataSource.setLoggingEnabled(true);
        data = new EntityDataStore<>(dataSource.getConfiguration());
    }
}

@@ -537,16 +537,56 @@
 Test %7B%0A%0A
+    private DatabaseSource dataSource;%0A%0A
     @Ove
@@ -834,31 +834,16 @@
         
-DatabaseSource 
 dataSour
@@ -1012,11 +1012,163 @@
 );%0A    %7D
+%0A%0A    @Override%0A    public void teardown() %7B%0A        super.teardown();%0A        if (dataSource != null) %7B%0A            dataSource.close();%0A        %7D%0A    %7D
 %0A%7D%0A

Fix SQLiteDiskIOException while running tests