Switched to random extension function.

This commit is contained in:
Erik C. Thauvin 2021-11-12 09:19:14 -08:00
parent 5dd8b36f92
commit 0a6b84fa2b
4 changed files with 4 additions and 8 deletions

View file

@ -50,7 +50,6 @@ import net.thauvin.erik.mobibot.modules.Weather2.Companion.getCountry
import net.thauvin.erik.mobibot.modules.Weather2.Companion.getWeather
import net.thauvin.erik.mobibot.modules.Weather2.Companion.mphToKmh
import org.testng.annotations.Test
import kotlin.random.Random
/**
* The `Weather2Test` class.
@ -69,7 +68,7 @@ class Weather2Test : LocalProperties() {
val country = OWM.Country.values()
repeat(3) {
val rand = country[Random.nextInt(0, country.size - 1)]
val rand = country[(country.indices).random()]
assertThat(getCountry(rand.value), rand.name).isEqualTo(rand)
}
}