google-developer-training / basic-android-kotlin-compose-training-inventory-app

Apache License 2.0
77 stars 84 forks source link

Read and update data using Room #118

Closed Loxad closed 4 months ago

Loxad commented 4 months ago

Where: URL of codelab: Step 5: Test your database

Problem: When i run the test daoInsert_insertsItemIntoDB() the test failes with expected:com.example.inventory.data.Item@5cb6703 but was:com.example.inventory.data.Item@4ff680

Versions Android Studio version: Jellyfish 2023.3.1

Possible solution: Override the equals() method in @Entity Item class so the assertEquals() method can use it to compare the objects.

Loxad commented 4 months ago

I ran the test on a real device. Maybe there is a difference when running it on an emulator

Loxad commented 4 months ago

I didnt make the Item class a data class. That solves it. My bad.