Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FoodDbDao_test error #16

Open
nadar71 opened this issue Nov 6, 2019 · 0 comments
Open

FoodDbDao_test error #16

nadar71 opened this issue Nov 6, 2019 · 0 comments
Labels
bug Something isn't working

Comments

@nadar71
Copy link
Owner

nadar71 commented Nov 6, 2019

Running the test, it ends with :
java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.List.get(int)' on a null object reference

as if the foodList from LiveData<List> foodListLive is null.
foodListLive is null as well if I comment all what is after : Observer<List> observer = res -> assertEquals(1,res.size());

The pb happens both if I use this for creating db :
foodDatabase = ((SingletonProvider) SingletonProvider.Companion.getsContext()).getDatabase();

or this :
foodDatabase = Room.inMemoryDatabaseBuilder(
InstrumentationRegistry.getInstrumentation().getContext(),
FoodDatabase.class)
//.addMigrations(FoodDatabase.Companion.MIGRATION_1_2)
.build();

with only differences that in the first data are inserted in the physical db on device, so they are in, but no list is recovered.

Maybe depending of not using androidx ?

@nadar71 nadar71 added the bug Something isn't working label Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant