lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r983500 - /lucene/dev/trunk/lucene/src/test/org/apache/lucene/messages/TestNLS.java
Date Mon, 09 Aug 2010 02:01:10 GMT
Author: rmuir
Date: Mon Aug  9 02:01:10 2010
New Revision: 983500

URL: http://svn.apache.org/viewvc?rev=983500&view=rev
Log:
LUCENE-2591: TestNLS fails with ja locale

Modified:
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/messages/TestNLS.java

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/messages/TestNLS.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/messages/TestNLS.java?rev=983500&r1=983499&r2=983500&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/messages/TestNLS.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/messages/TestNLS.java Mon Aug  9 02:01:10
2010
@@ -19,15 +19,20 @@ package org.apache.lucene.messages;
 
 import java.util.Locale;
 
-import junit.framework.TestCase;
+import org.apache.lucene.util.LocalizedTestCase;
 
 /**
  */
-public class TestNLS extends TestCase {
+public class TestNLS extends LocalizedTestCase {
   public void testMessageLoading() {
     Message invalidSyntax = new MessageImpl(
         MessagesTestBundle.Q0001E_INVALID_SYNTAX, "XXX");
-    assertEquals("Syntax Error: XXX", invalidSyntax.getLocalizedMessage());
+    /* 
+     * if the default locale is ja, you get ja as a fallback:
+     * see ResourceBundle.html#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)
+     */
+    if (!Locale.getDefault().getLanguage().equals("ja"))
+      assertEquals("Syntax Error: XXX", invalidSyntax.getLocalizedMessage(Locale.ENGLISH));
   }
 
   public void testMessageLoading_ja() {
@@ -39,12 +44,22 @@ public class TestNLS extends TestCase {
 
   public void testNLSLoading() {
     String message = NLS
-        .getLocalizedMessage(MessagesTestBundle.Q0004E_INVALID_SYNTAX_ESCAPE_UNICODE_TRUNCATION);
-    assertEquals("Truncated unicode escape sequence.", message);
+        .getLocalizedMessage(MessagesTestBundle.Q0004E_INVALID_SYNTAX_ESCAPE_UNICODE_TRUNCATION,
Locale.ENGLISH);
+    /* 
+     * if the default locale is ja, you get ja as a fallback:
+     * see ResourceBundle.html#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)
+     */
+    if (!Locale.getDefault().getLanguage().equals("ja"))
+      assertEquals("Truncated unicode escape sequence.", message);
 
-    message = NLS.getLocalizedMessage(MessagesTestBundle.Q0001E_INVALID_SYNTAX,
+    message = NLS.getLocalizedMessage(MessagesTestBundle.Q0001E_INVALID_SYNTAX, Locale.ENGLISH,
         "XXX");
-    assertEquals("Syntax Error: XXX", message);
+    /* 
+     * if the default locale is ja, you get ja as a fallback:
+     * see ResourceBundle.html#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)
+     */
+    if (!Locale.getDefault().getLanguage().equals("ja"))
+      assertEquals("Syntax Error: XXX", message);
   }
 
   public void testNLSLoading_ja() {
@@ -63,11 +78,21 @@ public class TestNLS extends TestCase {
     String message = NLS.getLocalizedMessage(
         MessagesTestBundle.Q0004E_INVALID_SYNTAX_ESCAPE_UNICODE_TRUNCATION,
         locale);
-    assertEquals("Truncated unicode escape sequence.", message);
+    /* 
+     * if the default locale is ja, you get ja as a fallback:
+     * see ResourceBundle.html#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)
+     */
+    if (!Locale.getDefault().getLanguage().equals("ja"))
+      assertEquals("Truncated unicode escape sequence.", message);
 
     message = NLS.getLocalizedMessage(MessagesTestBundle.Q0001E_INVALID_SYNTAX,
         locale, "XXX");
-    assertEquals("Syntax Error: XXX", message);
+    /* 
+     * if the default locale is ja, you get ja as a fallback:
+     * see ResourceBundle.html#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)
+     */
+    if (!Locale.getDefault().getLanguage().equals("ja"))
+      assertEquals("Syntax Error: XXX", message);
   }
 
   public void testMissingMessage() {



Mime
View raw message