Closed Loxad closed 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.
I ran the test on a real device. Maybe there is a difference when running it on an emulator
I didnt make the Item class a data class. That solves it. My bad.
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.