Robolectric: Multi-Tests problem at Room , the arch-component

Created on 5 Nov 2017  路  4Comments  路  Source: robolectric/robolectric

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

All 4 comments

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

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 ?

Was this page helpful?
0 / 5 - 0 ratings