VREMSoftwareDevelopment / WiFiAnalyzer

Android application to analyze WiFi signals.
https://vremsoftwaredevelopment.github.io/WiFiAnalyzer/
GNU General Public License v3.0
2.96k stars 578 forks source link

Test failure: com.vrem.wifianalyzer.wifi.band.WifiChannelCountryTest.testFindCorrectlyPopulatesCountryCodeAndName fails depending on the OS language #358

Closed jswolf19 closed 2 years ago

jswolf19 commented 2 years ago

I'm getting a failure on the test testFindCorrectlyPopulatesCountryCodeAndName, specifically the assertion that expected.displayCountry does not equal actual.countryName(expected).

I'm not sure what is expected with this assertion (or why it is necessary to test), nor do I know why it does not behave as expected in my environment.

I'm running Windows 10 20H2 19042.1266, android studio 2020.3.1 Patch 2, adoptopenjdk 11.0.12.7-hotspot

jswolf19 commented 2 years ago

It seems that my OS language being Japanese is also relevant. When I switch it to English, the test passes.

jswolf19 commented 2 years ago

I can see four options.

  1. Leave it as is. While not what I would prefer (as I'm affected by this), it would seem that either current contributors are not affected, or they don't consider it an issue.
  2. Remove the assertion. Only a guess, but it's likely just there to show that the country name is in the locale provided and not the display locale.
  3. Change the expected value to expected.getDisplayCountry(Locale.ENGLISH).
  4. Use Locale.setDefault(Locale.ENGLISH) to enforce that the display locale is not dependent on the environment. If tests are done in parallel, this could cause trouble elsewhere as this is changing global state.
VREMSoftwareDevelopment commented 2 years ago

Fixed

jswolf19 commented 2 years ago

@VREMSoftwareDevelopment fix confirmed, thanks!