popstellar
popstellar copied to clipboard
Some UI tests throw exceptions
Description (Actual behavior)
When Room was added to the application, it generated some tests to create and open a database instance without closing it. This issue is present only for the tests executed with Roboeletric in the UI folder (+ some tests for the handlers test/utility/handler
).
This is the error:
System.logW: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
java.lang.Throwable: Explicit termination method 'close' not called
Expected behavior
The opened db instances should be closed. Or, if not, we need to suppress the logs as they slow and make noisy the CI and make other test issues difficult to debug.
How to reproduce
Simply execute the tests and see the stack trace.
Impact
Low impact: slow down the CI and make the tests logs noisy
Possible root cause
My best guess is that we should inject the appDB in every test that uses it without closing it and then closing it manually in the tearDown of the tests.