URL of codelab
https://developer.android.com/codelabs/android-basics-kotlin-test-viewmodel-and-livedata?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-4%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fandroid-basics-kotlin-test-viewmodel-and-livedata#5
In which task and step of the codelab can this issue be found?
3
Describe the problem
The 3rd step tells to make a price check test and add this code :
- "assertEquals("$27.00", viewModel.price.value)"
Knowing that the transformation happening in OrderViewModel will format to the current locale currency info, which for me is BR info, i fixed so it would fit my nationality, then i tried :
- "assertEquals("R$27.00", viewModel.price.value)"
- "assertEquals("R$ 27.00", viewModel.price.value)"
- "assertEquals("R$27,00", viewModel.price.value)"
- "assertEquals("R$ 27,00", viewModel.price.value)"
Then i got the error on the images attached.
Steps to reproduce?
- Go to... src>androidTest>ViewModelTests
- Click on... Run "price_twelve_cupcake()"
- See error...
expected:<R$[ ]27,00> but was:<R$[ ]27,00>
Expected :R$ 27,00
Actual :R$ 27,00
org.junit.ComparisonFailure: expected:<R$[ ]27,00> but was:<R$[ ]27,00>
Versions
Android Studio version:
Android Studio Bumblebee | 2021.1.1
Build #AI-211.7628.21.2111.8092744, built on January 19, 2022
Runtime version: 11.0.11+9-b60-7590822 amd64
VM: OpenJDK 64-Bit Server VM by Oracle Corporation
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 4
Registry: external.system.auto.import.disabled=true, debugger.watches.in.variables=false
Non-Bundled Plugins: org.jetbrains.kotlin (211-1.6.10-release-923-AS7442.40), org.intellij.featureSuggester (211.205), org.intellij.plugins.markdown (211.7142.37)
API version of the emulator:
Android version : 11.0(R) - API 30
Emulator Version : 31.2.6-8100890
Additional information
Include screenshots if they would be useful in clarifying the problem.
This is my Test code:
![image](https://user-images.githubusercontent.com/63316622/152351799-89055e64-c441-4401-accf-b2fab4d4a0c3.png)
This is the error notification:
![image](https://user-images.githubusercontent.com/63316622/152352177-5bb9cda8-fab1-4759-b8cf-095612021114.png)
Here is the error description:
![image](https://user-images.githubusercontent.com/63316622/152351916-f0bea2ce-7c77-4b93-9a41-1b3310a3d9ea.png)