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 - expected and actual value of assertEquals mixed up #48

Open fe60 opened 1 year ago

fe60 commented 1 year ago

Android Basics with Compose Unit 6: Data persistence Use Room for data persistence Read and update data with Room

In which task and step of the codelab can this issue be found? All steps implementing a test using assertEquals(Object expected, Object actual)

Describe the problem In tests the expected and the actual objects are passed to the wrong parameter.

Steps to reproduce? Just check the solution code. It's the same in the code snippets in the course. item1 and item2 are the reference objects. https://github.com/google-developer-training/basic-android-kotlin-compose-training-inventory-app/blob/054a669c78ba3b35cb71c1f511575240541f0db7/app/src/androidTest/java/com/example/inventory/ItemDaoTest.kt#L41-L42

They are passed as the actual object.

https://github.com/google-developer-training/basic-android-kotlin-compose-training-inventory-app/blob/054a669c78ba3b35cb71c1f511575240541f0db7/app/src/androidTest/java/com/example/inventory/ItemDaoTest.kt#L67

https://github.com/google-developer-training/basic-android-kotlin-compose-training-inventory-app/blob/054a669c78ba3b35cb71c1f511575240541f0db7/app/src/androidTest/java/com/example/inventory/ItemDaoTest.kt#L75-L76

https://github.com/google-developer-training/basic-android-kotlin-compose-training-inventory-app/blob/054a669c78ba3b35cb71c1f511575240541f0db7/app/src/androidTest/java/com/example/inventory/ItemDaoTest.kt#L85

https://github.com/google-developer-training/basic-android-kotlin-compose-training-inventory-app/blob/054a669c78ba3b35cb71c1f511575240541f0db7/app/src/androidTest/java/com/example/inventory/ItemDaoTest.kt#L106-L107