Bug P2
Status Update
Comments
je...@google.com <je...@google.com>
se...@google.com <se...@google.com>
da...@google.com <da...@google.com> #2
Do you have a repro project that you could share with us?
There should be no need to excluding any dependencies: we automatically remove them from the test APK if they are in the main APK.
There should be no need to excluding any dependencies: we automatically remove them from the test APK if they are in the main APK.
Description
Steps to reproduce:
1. Set up a project using the 2.1.0-beta01 version of the Sqlite Android X library
2. Create a ContentProvider
a. When configuring the database in the ContentProvider, set the builder to use the noBackupDirectory. E.g. SupportSQLiteOpenHelper.Configuration.builder.noBackupDirectory(true)
b. In the ContentProvider's shutdown method, call close on the database
4. Create a test case using ProviderTestRule
5. Run the test case
Results:
Expected: The test case completes without any issues.
Actual: The test case fails because the database can't be closed since the DelegatingContext throws. Example stacktrace below:
java.lang.UnsupportedOperationException
at androidx.test.rule.provider.DelegatingContext.getNoBackupFilesDir(DelegatingContext.java:392)
at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper.getDelegate(FrameworkSQLiteOpenHelper.java:75)
at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper.close(FrameworkSQLiteOpenHelper.java:116)
at com.twofortyfouram.memento.provider.MementoContentProvider.shutdown(MementoContentProvider.java:213)
at androidx.test.rule.provider.ProviderTestRule.cleanUpProviders(ProviderTestRule.java:331)
at androidx.test.rule.provider.ProviderTestRule.access$100(ProviderTestRule.java:134)
at androidx.test.rule.provider.ProviderTestRule$ProviderStatement.evaluate(ProviderTestRule.java:559)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at androidx.test.ext.junit.runners.AndroidJUnit4.run(AndroidJUnit4.java:104)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:395)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2196)