java.lang.AssertionError: Error(s) present: [java.lang.IllegalStateException: Illegal connection pointer 1. Current pointers for thread Thread[RxCachedThreadScheduler-8,5,main] []] (latch = 0, values = 0, errors = 1, completions = 0)
I use Room to play with SQLite. Everything is fine when the application runs and single-test will be played. All successfully.
The problem is if I run Robolectric-tests with more than two cases, the tests can not run go through.
Checkout this , this . They help might be at other ORMs, howerver, doesn't help at Room.
Any idea?
also asked here
Just add
@After
public void after() {
Database.INSTANCE.close();
}
where Database.INSTANCE is instance of database built with Room.databaseBuilder
@starsep , can you provide a working sample, as this method of closing the instance doesn't work
It works for me :smiley:
https://github.com/starsep/Sokoban/blob/master/app/src/main/java/com/starsep/sokoban/release/database/Database.kt <- Database singleton in Kotlin
https://github.com/starsep/Sokoban/blob/master/app/src/test/java/com/starsep/sokoban/release/activity/MainMenuActivityTest.java <- Some simple tests in Java
I run into the same error (using Robolectric 4.3.1 and Room 2.2.3).
So far my tests still pass, but there is a lot of log noise.
Closing the database instance did not work for me. Did you find another solution @XinyueZ ?
Most helpful comment
It works for me :smiley:
https://github.com/starsep/Sokoban/blob/master/app/src/main/java/com/starsep/sokoban/release/database/Database.kt <- Database singleton in Kotlin
https://github.com/starsep/Sokoban/blob/master/app/src/test/java/com/starsep/sokoban/release/activity/MainMenuActivityTest.java <- Some simple tests in Java