简体   繁体   中英

The Robolectric-Tests case errors with Room-library(arch-component)

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 .

Faced with the same issue

you need to close database

 @After
 public void closeDb() throws IOException {
    database.close();
 }

And also, I noticed, that if one test ( which works with database ) fails, than every tests would fail too with such error. So, make sure that every tests works fine by standalone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM