use Languages class as source of locales to test
This commit is contained in:
		
							parent
							
								
									3a194026fa
								
							
						
					
					
						commit
						67f40367cd
					
				| @ -14,9 +14,8 @@ import org.junit.Test; | |||||||
| import org.junit.runner.RunWith; | import org.junit.runner.RunWith; | ||||||
| 
 | 
 | ||||||
| import java.lang.reflect.Field; | import java.lang.reflect.Field; | ||||||
| import java.util.ArrayList; |  | ||||||
| import java.util.Collections; |  | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
|  | import java.util.HashSet; | ||||||
| import java.util.Locale; | import java.util.Locale; | ||||||
| import java.util.regex.Matcher; | import java.util.regex.Matcher; | ||||||
| import java.util.regex.Pattern; | import java.util.regex.Pattern; | ||||||
| @ -35,7 +34,7 @@ public class LocalizationTest { | |||||||
| 
 | 
 | ||||||
|     private final Pattern androidFormat = Pattern.compile("(%[a-z0-9]\\$?[a-z]?)"); |     private final Pattern androidFormat = Pattern.compile("(%[a-z0-9]\\$?[a-z]?)"); | ||||||
|     private final Locale[] locales = Locale.getAvailableLocales(); |     private final Locale[] locales = Locale.getAvailableLocales(); | ||||||
|     private final ArrayList<String> localeNames = new ArrayList<>(locales.length); |     private final HashSet<String> localeNames = new HashSet<>(locales.length); | ||||||
| 
 | 
 | ||||||
|     private AssetManager assets; |     private AssetManager assets; | ||||||
|     private Configuration config; |     private Configuration config; | ||||||
| @ -43,10 +42,12 @@ public class LocalizationTest { | |||||||
| 
 | 
 | ||||||
|     @Before |     @Before | ||||||
|     public void setUp() { |     public void setUp() { | ||||||
|  |         for (Locale locale : Languages.LOCALES_TO_TEST) { | ||||||
|  |             localeNames.add(locale.toString()); | ||||||
|  |         } | ||||||
|         for (Locale locale : locales) { |         for (Locale locale : locales) { | ||||||
|             localeNames.add(locale.toString()); |             localeNames.add(locale.toString()); | ||||||
|         } |         } | ||||||
|         Collections.sort(localeNames); |  | ||||||
| 
 | 
 | ||||||
|         Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); |         Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); | ||||||
|         Context context = instrumentation.getTargetContext(); |         Context context = instrumentation.getTargetContext(); | ||||||
|  | |||||||
| @ -203,7 +203,7 @@ public final class Languages { | |||||||
|         return Character.toUpperCase(line.charAt(0)) + line.substring(1); |         return Character.toUpperCase(line.charAt(0)) + line.substring(1); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private static final Locale[] LOCALES_TO_TEST = { |     public static final Locale[] LOCALES_TO_TEST = { | ||||||
|             Locale.ENGLISH, |             Locale.ENGLISH, | ||||||
|             Locale.FRENCH, |             Locale.FRENCH, | ||||||
|             Locale.GERMAN, |             Locale.GERMAN, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Hans-Christoph Steiner
						Hans-Christoph Steiner