I've got maven project in Android Studio. I'm using Robolectric with Roboguice to simplify testing of the app.
I have about 30 tests written. All of them work fine in the IDE, but 2 of them fail when I run them with
mvn test
The tests fail on Fragment which is added to Activity by XML. The onActivityCreated method of this fragment, accesses an injected reference which is apparently null at this point (causing NPE).
I'm wondering what can be the difference in the runtime environment between AS and pure maven.
EDIT:
The object marked as singleton was released in the previous test, causing the NPE. Somehow AS test runner works differently from maven, running the test in different context. Any idea how is it possible?