Author: jverhaeg(a)redhat.com
Date: 2008-08-18 14:45:57 -0400 (Mon, 18 Aug 2008)
New Revision: 439
Modified:
trunk/dna-common/src/test/java/org/jboss/dna/common/AbstractI18nTest.java
Log:
DNA-207: Changed AbstractI18nTest to use the locale and problem methods from I18n.class
rather than assuming each i18n class contains corresponding methods.
Modified: trunk/dna-common/src/test/java/org/jboss/dna/common/AbstractI18nTest.java
===================================================================
--- trunk/dna-common/src/test/java/org/jboss/dna/common/AbstractI18nTest.java 2008-08-18
16:58:48 UTC (rev 438)
+++ trunk/dna-common/src/test/java/org/jboss/dna/common/AbstractI18nTest.java 2008-08-18
18:45:57 UTC (rev 439)
@@ -25,7 +25,6 @@
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import java.lang.reflect.Field;
-import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Locale;
import java.util.Set;
@@ -44,7 +43,6 @@
}
@Test
- @SuppressWarnings( "unchecked" )
public void shouldNotHaveProblems() throws Exception {
for (Field fld : i18nClass.getDeclaredFields()) {
if (fld.getType() == I18n.class && (fld.getModifiers() &
Modifier.PUBLIC) == Modifier.PUBLIC
@@ -57,12 +55,10 @@
}
}
// Check for global problems after checking field problems since global problems
are detected lazily upon field usage
- Method method =
i18nClass.getDeclaredMethod("getLocalizationProblemLocales", (Class[])null);
- Set<Locale> locales = (Set<Locale>)method.invoke(null,
(Object[])null);
+ Set<Locale> locales = I18n.getLocalizationProblemLocales(i18nClass);
if (!locales.isEmpty()) {
- method = i18nClass.getDeclaredMethod("getLocalizationProblems",
Locale.class);
for (Locale locale : locales) {
- Set<String> problems = (Set<String>)method.invoke(null,
locale);
+ Set<String> problems = I18n.getLocalizationProblems(i18nClass,
locale);
try {
assertThat(problems.isEmpty(), is(true));
} catch (AssertionError error) {
Show replies by date