Skip to content

Commit aae1527

Browse files
committed
mapstruct#883 Simplifying look-up of test locale
1 parent 614f0ea commit aae1527

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

processor/src/test/java/org/mapstruct/ap/internal/util/StringsTest.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,12 @@ public void decapitalizeTurkish() {
157157
}
158158

159159
private static Locale getTurkeyLocale() {
160-
Locale[] availableLocales = Locale.getAvailableLocales();
161-
for ( Locale locale : availableLocales ) {
162-
if ( locale.getLanguage().equals( "tr" ) ) {
163-
return locale;
164-
}
160+
Locale turkeyLocale = Locale.forLanguageTag( "tr" );
161+
162+
if ( turkeyLocale == null ) {
163+
throw new IllegalStateException( "Can't find Turkey locale." );
165164
}
166-
throw new IllegalStateException( "Can't find Turkey locale." );
167-
}
168165

166+
return turkeyLocale;
167+
}
169168
}

0 commit comments

Comments
 (0)