Skip to main content
Glama
LocaleUtilsTest.kt2.17 kB
package maestro.utils import maestro.Platform import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows import com.google.common.truth.Truth.assertThat internal class LocaleUtilsTest { @Test internal fun `parseLocaleParams when invalid locale is received throws WrongLocaleFormat exception`() { assertThrows<LocaleValidationWrongLocaleFormatException> { LocaleUtils.parseLocaleParams("someInvalidLocale", Platform.ANDROID) } } @Test internal fun `parseLocaleParams when not supported platform is received throws NotSupportedPlatform exception`() { assertThrows<LocaleValidationNotSupportedPlatformException> { LocaleUtils.parseLocaleParams("de_DE", Platform.WEB) } } @Test internal fun `parseLocaleParams when not supported locale is received and platform is iOS throws ValidationIos exception`() { assertThrows<LocaleValidationIosException> { LocaleUtils.parseLocaleParams("de_IN", Platform.IOS) } } @Test internal fun `parseLocaleParams when not supported locale language is received and platform is Android throws ValidationAndroidLanguage exception`() { assertThrows<LocaleValidationAndroidLanguageException> { LocaleUtils.parseLocaleParams("ee_IN", Platform.ANDROID) } } @Test internal fun `parseLocaleParams when not supported locale country is received and platform is Android throws ValidationAndroidLanguage exception`() { assertThrows<LocaleValidationAndroidCountryException> { LocaleUtils.parseLocaleParams("hi_EE", Platform.ANDROID) } } @Test internal fun `parseLocaleParams when supported locale is received returns correct language and country codes`() { val (language1, country1) = LocaleUtils.parseLocaleParams("de_DE", Platform.ANDROID) val (language2, country2) = LocaleUtils.parseLocaleParams("es_ES", Platform.IOS) assertThat(language1).isEqualTo("de") assertThat(country1).isEqualTo("DE") assertThat(language2).isEqualTo("es") assertThat(country2).isEqualTo("ES") } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mobile-dev-inc/Maestro'

If you have feedback or need assistance with the MCP directory API, please join our Discord server