#883 Simplifying look-up of test locale

This commit is contained in:
Gunnar Morling 2017-07-07 17:52:09 +02:00
parent 614f0ea4ee
commit aae1527352

View File

@ -157,13 +157,12 @@ public class StringsTest {
} }
private static Locale getTurkeyLocale() { private static Locale getTurkeyLocale() {
Locale[] availableLocales = Locale.getAvailableLocales(); Locale turkeyLocale = Locale.forLanguageTag( "tr" );
for ( Locale locale : availableLocales ) {
if ( locale.getLanguage().equals( "tr" ) ) {
return locale;
}
}
throw new IllegalStateException( "Can't find Turkey locale." );
}
if ( turkeyLocale == null ) {
throw new IllegalStateException( "Can't find Turkey locale." );
}
return turkeyLocale;
}
} }