You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by pa...@apache.org on 2019/01/15 19:31:49 UTC
svn commit: r1851408 - in /turbine/fulcrum/trunk/localization: src/changes/
src/java/org/apache/fulcrum/localization/
src/test/org/apache/fulcrum/localization/ xdocs/
Author: painter
Date: Tue Jan 15 19:31:48 2019
New Revision: 1851408
URL: http://svn.apache.org/viewvc?rev=1851408&view=rev
Log:
Update Javadocs, move to JUnit 5, update changes.xml location, cleanup some of the StringUtil method calls to improve readability
Added:
turbine/fulcrum/trunk/localization/src/changes/
turbine/fulcrum/trunk/localization/src/changes/changes.xml
Removed:
turbine/fulcrum/trunk/localization/xdocs/changes.xml
Modified:
turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/DefaultLocalizationService.java
turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/LocaleTokenizer.java
turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/LocalizationService.java
turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/SimpleLocalizationService.java
turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/SimpleLocalizationServiceImpl.java
turbine/fulcrum/trunk/localization/src/test/org/apache/fulcrum/localization/LocaleTokenizerTest.java
turbine/fulcrum/trunk/localization/src/test/org/apache/fulcrum/localization/LocalizationTest.java
Added: turbine/fulcrum/trunk/localization/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/localization/src/changes/changes.xml?rev=1851408&view=auto
==============================================================================
--- turbine/fulcrum/trunk/localization/src/changes/changes.xml (added)
+++ turbine/fulcrum/trunk/localization/src/changes/changes.xml Tue Jan 15 19:31:48 2019
@@ -0,0 +1,92 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<document>
+ <properties>
+ <title>Fulcrum Localization</title>
+ <author email="epugh@upstate.com">Eric Pugh</author>
+ </properties>
+
+ <body>
+ <release version="1.0.7" date="in SVN">
+ <action dev="painter" type="update">
+ Moved changes.xml location for inclusion in report generation
+ </action>
+ <action dev="painter" type="update">
+ Update to Java 8
+ </action>
+ <action dev="painter" type="update">
+ Added commons-lang3
+ </action>
+ <action dev="painter" type="update">
+ Update unit tests to BaseUnit5Test
+ </action>
+ <action dev="painter" type="update">
+ Update to yaafi-1.0.8 and testcontainer 1.0.8
+ </action>
+ </release>
+ <release version="1.0.6" date="2009-06-18">
+ <action dev="tv" type="add">
+ Added a Maven-2 build.
+ </action>
+ <action dev="tv" type="add">
+ Split the service into a simple one that does not depend on servlet-api
+ and an extended one that does. This allows to use the service in non-web
+ environments without hassles.
+ </action>
+ <action dev="epugh" type="update" due-to="Kostyantyn Shchekotykhin">
+ Fix unit tests to run properly in non US english environments.
+ </action>
+ </release>
+ <release version="1.0.5" date="2004-11-24">
+ <action dev="epugh" type="update" due-to="Kostyantyn Shchekotykhin">
+ Merge api and impl jars into one project.
+ </action>
+ <action dev="epugh" type="remove">
+ Remove Localization, it was a facade that shouldn't be here.
+ Facade's of this nature are specific to the user...
+ </action>
+ <action dev="epugh" type="update">
+ Tweak dependencies to build under gump.
+ </action>
+ <action dev="epugh" type="update">
+ Bump versions, clean up dependencies
+ </action>
+ </release>
+ <release version="1.0.4" date="">
+ <action dev="epugh" type="update">
+ Use inherited getLogger() instead of Log in classes
+ extending AbstractLogEnabled.
+ </action>
+ <action dev="epugh" type="update">
+ Update to use Merlin 3.3.0
+ </action>
+ <action dev="epugh" type="add">
+ Merlinized code with input from Stephen
+ </action>
+ </release>
+ <release version="1.0-alpha-3" date="">
+ <action dev="epugh" type="add">
+ New Localization class that is a facade to the underlying service.
+ </action>
+ </release>
+
+ </body>
+</document>
+
Modified: turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/DefaultLocalizationService.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/DefaultLocalizationService.java?rev=1851408&r1=1851407&r2=1851408&view=diff
==============================================================================
--- turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/DefaultLocalizationService.java (original)
+++ turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/DefaultLocalizationService.java Tue Jan 15 19:31:48 2019
@@ -27,9 +27,11 @@ import javax.servlet.http.HttpServletReq
import org.apache.commons.lang3.StringUtils;
/**
- * <p>This class is the single point of access to all localization
+ * <p>
+ * This class is the single point of access to all localization
* resources. It caches different ResourceBundles for different
- * Locales.</p>
+ * Locales.
+ * </p>
*
* <p>Usage example:</p>
*
@@ -40,8 +42,10 @@ import org.apache.commons.lang3.StringUt
* </code>
* </pre>
*
- * <p>Then call {@link #getString(String, Locale, String)}, or one of
- * four methods to retrieve a ResourceBundle:</p>
+ * <p>
+ * Then call {@link #getString(String, Locale, String)}, or one of
+ * four methods to retrieve a ResourceBundle:
+ * </p>
*
* <ul>
* <li>getBundle("MyBundleName")</li>
@@ -78,6 +82,8 @@ public class DefaultLocalizationService
* This method returns a ResourceBundle given the bundle name and
* the Locale information supplied in the HTTP "Accept-Language"
* header.
+ *
+ * @see org.apache.fulcrum.localization.LocalizationService#getBundle(java.lang.String, java.lang.String)
*
* @param bundleName Name of bundle.
* @param languageHeader A String with the language header.
@@ -102,6 +108,8 @@ public class DefaultLocalizationService
}
/**
+ * @see org.apache.fulcrum.localization.LocalizationService#getBundle(java.lang.String, javax.servlet.http.HttpServletRequest)
+ *
* This method returns a ResourceBundle given the bundle name and
* the Locale information supplied in the HTTP "Accept-Language"
* header which is stored in HttpServletRequest.
@@ -116,8 +124,8 @@ public class DefaultLocalizationService
return getBundle(bundleName, getLocale(req));
}
- /**
- * @see org.apache.fulcrum.localization.LocalizationService#getLocale(HttpServletRequest)
+ /* (non-Javadoc)
+ * @see org.apache.fulcrum.localization.LocalizationService#getLocale(javax.servlet.http.HttpServletRequest)
*/
public Locale getLocale(HttpServletRequest req)
{
@@ -128,8 +136,8 @@ public class DefaultLocalizationService
// return (l != null ? l : getLocale(req.getHeader(ACCEPT_LANGUAGE)));
}
- /**
- * @see org.apache.fulcrum.localization.LocalizationService#getLocale(String)
+ /* (non-Javadoc)
+ * @see org.apache.fulcrum.localization.LocalizationService#getLocale(java.lang.String)
*/
public Locale getLocale(String header)
{
Modified: turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/LocaleTokenizer.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/LocaleTokenizer.java?rev=1851408&r1=1851407&r2=1851408&view=diff
==============================================================================
--- turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/LocaleTokenizer.java (original)
+++ turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/LocaleTokenizer.java Tue Jan 15 19:31:48 2019
@@ -1,6 +1,5 @@
package org.apache.fulcrum.localization;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -28,8 +27,6 @@ import java.util.Locale;
import java.util.NoSuchElementException;
import java.util.StringTokenizer;
-import org.apache.fulcrum.localization.LocaleTokenizer.AcceptLanguage;
-
/**
* Parses the HTTP <code>Accept-Language</code> header as per section
* 14.4 of RFC 2068 (HTTP 1.1 header field definitions).
@@ -38,7 +35,7 @@ import org.apache.fulcrum.localization.L
* @version $Id$
*/
public class LocaleTokenizer
- implements Iterator
+ implements Iterator<Object>
{
/**
* Separates elements of the <code>Accept-Language</code> HTTP
Modified: turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/LocalizationService.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/LocalizationService.java?rev=1851408&r1=1851407&r2=1851408&view=diff
==============================================================================
--- turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/LocalizationService.java (original)
+++ turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/LocalizationService.java Tue Jan 15 19:31:48 2019
@@ -27,15 +27,19 @@ import java.util.ResourceBundle;
import javax.servlet.http.HttpServletRequest;
/**
- * <p>Provides localization functionality using the interface provided
+ * <p>
+ * Provides localization functionality using the interface provided
* by <code>ResourceBundle</code>, plus leverages a "search path"
* style traversal of the <code>ResourceBundle</code> objects named by
* the <code>locale.default.bundles</code> to discover a value for a
- * given key.</p>
+ * given key.
+ * </p>
*
- * <p>It is suggested that one handle
+ * <p>
+ * It is suggested that one handle
* <a href="http://www.math.fu-berlin.de/~rene/www/java/tutorial/i18n/message/messageFormat.html">dealing with concatenated messages</a>
- * using <code>MessageFormat</code> and properties files.</p>
+ * using <code>MessageFormat</code> and properties files.
+ * </p>
*
* @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
Modified: turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/SimpleLocalizationService.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/SimpleLocalizationService.java?rev=1851408&r1=1851407&r2=1851408&view=diff
==============================================================================
--- turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/SimpleLocalizationService.java (original)
+++ turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/SimpleLocalizationService.java Tue Jan 15 19:31:48 2019
@@ -1,6 +1,5 @@
package org.apache.fulcrum.localization;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -26,15 +25,19 @@ import java.util.MissingResourceExceptio
import java.util.ResourceBundle;
/**
- * <p>Provides localization functionality using the interface provided
+ * <p>
+ * Provides localization functionality using the interface provided
* by <code>ResourceBundle</code>, plus leverages a "search path"
* style traversal of the <code>ResourceBundle</code> objects named by
* the <code>locale.default.bundles</code> to discover a value for a
- * given key.</p>
+ * given key.
+ * </p>
*
- * <p>It is suggested that one handle
+ * <p>
+ * It is suggested that one handle
* <a href="http://www.math.fu-berlin.de/~rene/www/java/tutorial/i18n/message/messageFormat.html">dealing with concatenated messages</a>
- * using <code>MessageFormat</code> and properties files.</p>
+ * using <code>MessageFormat</code> and properties files.
+ * </p>
*
* @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
Modified: turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/SimpleLocalizationServiceImpl.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/SimpleLocalizationServiceImpl.java?rev=1851408&r1=1851407&r2=1851408&view=diff
==============================================================================
--- turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/SimpleLocalizationServiceImpl.java (original)
+++ turbine/fulcrum/trunk/localization/src/java/org/apache/fulcrum/localization/SimpleLocalizationServiceImpl.java Tue Jan 15 19:31:48 2019
@@ -34,9 +34,11 @@ import org.apache.avalon.framework.logge
import org.apache.commons.lang3.StringUtils;
/**
- * <p>This class is the single point of access to all localization
+ * <p>
+ * This class is the single point of access to all localization
* resources. It caches different ResourceBundles for different
- * Locales.</p>
+ * Locales.
+ * </p>
*
* <p>Usage example:</p>
*
@@ -47,8 +49,10 @@ import org.apache.commons.lang3.StringUt
* </code>
* </pre>
*
- * <p>Then call {@link #getString(String, Locale, String)}, or one of
- * two methods to retrieve a ResourceBundle:</p>
+ * <p>
+ * Then call {@link #getString(String, Locale, String)}, or one of
+ * two methods to retrieve a ResourceBundle:
+ * </p>
*
* <ul>
* <li>getBundle("MyBundleName")</li>
@@ -163,7 +167,6 @@ public class SimpleLocalizationServiceIm
@Override
public void initialize() throws Exception
{
- // initBundleNames(null);
defaultLocale = new Locale(defaultLanguage, defaultCountry);
if (getLogger().isInfoEnabled())
{
@@ -241,7 +244,7 @@ public class SimpleLocalizationServiceIm
}
/**
- * {@link org.apache.fulcrum.localization.SimpleLocalizationService#getBundle()}
+ * @see org.apache.fulcrum.localization.SimpleLocalizationService#getBundle()
*
* @return the default resource bundle
*/
@@ -252,7 +255,7 @@ public class SimpleLocalizationServiceIm
}
/**
- * {@link org.apache.fulcrum.localization.SimpleLocalizationService#getBundle(String)}
+ * @see org.apache.fulcrum.localization.SimpleLocalizationService#getBundle(java.lang.String)
*
* @param bundleName the name of a bundle
* @return the resource bundle
@@ -264,6 +267,8 @@ public class SimpleLocalizationServiceIm
}
/**
+ * @see org.apache.fulcrum.localization.SimpleLocalizationService#getBundle(java.lang.String, java.util.Locale)
+ *
* This method returns a ResourceBundle for the given bundle name
* and the given Locale.
*
@@ -385,7 +390,7 @@ public class SimpleLocalizationServiceIm
Map<Locale, ResourceBundle> bundlesByLocale)
{
ResourceBundle rb = null;
- if (!StringUtils.isNotEmpty(locale.getCountry())
+ if (StringUtils.isEmpty(locale.getCountry())
&& defaultLanguage.equals(locale.getLanguage()))
{
/*
@@ -402,7 +407,7 @@ public class SimpleLocalizationServiceIm
}
}
else if (
- !StringUtils.isNotEmpty(locale.getLanguage())
+ StringUtils.isEmpty(locale.getLanguage())
&& defaultCountry.equals(locale.getCountry()))
{
Locale withDefaultLanguage =
@@ -413,6 +418,7 @@ public class SimpleLocalizationServiceIm
rb = getBundleIgnoreException(bundleName, withDefaultLanguage);
}
}
+
if (rb == null && !defaultLocale.equals(locale))
{
rb = getBundleIgnoreException(bundleName, defaultLocale);
@@ -582,8 +588,8 @@ public class SimpleLocalizationServiceIm
return format(bundleName, locale, key, new Object[] { arg1 });
}
- /**
- * {@link org.apache.fulcrum.localization.SimpleLocalizationService#format(String, Locale, String, Object, Object)}
+ /* (non-Javadoc)
+ * @see org.apache.fulcrum.localization.SimpleLocalizationService#format(java.lang.String, java.util.Locale, java.lang.String, java.lang.Object, java.lang.Object)
*/
@Override
public String format(
Modified: turbine/fulcrum/trunk/localization/src/test/org/apache/fulcrum/localization/LocaleTokenizerTest.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/localization/src/test/org/apache/fulcrum/localization/LocaleTokenizerTest.java?rev=1851408&r1=1851407&r2=1851408&view=diff
==============================================================================
--- turbine/fulcrum/trunk/localization/src/test/org/apache/fulcrum/localization/LocaleTokenizerTest.java (original)
+++ turbine/fulcrum/trunk/localization/src/test/org/apache/fulcrum/localization/LocaleTokenizerTest.java Tue Jan 15 19:31:48 2019
@@ -1,6 +1,5 @@
package org.apache.fulcrum.localization;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -20,12 +19,15 @@ package org.apache.fulcrum.localization;
* under the License.
*/
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.Locale;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.apache.fulcrum.testcontainer.BaseUnit5Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
/**
* Test case for the locale tokenizer.
@@ -34,35 +36,32 @@ import junit.framework.TestSuite;
* @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
* @version $Id$
*/
-public class LocaleTokenizerTest
- extends TestCase
+public class LocaleTokenizerTest extends BaseUnit5Test
{
private static final String HEADER = "en, es;q=0.8, zh-TW;q=0.1";
- public LocaleTokenizerTest(String name)
- {
- super(name);
+ @BeforeEach
+ public void setup() {
+
}
-
- public static Test suite()
- {
- return new TestSuite(LocaleTokenizerTest.class);
- }
-
+
+ @Test
public void testLocaleTokenizer()
{
try
{
LocaleTokenizer tok = new LocaleTokenizer(HEADER);
Locale locale = (Locale) tok.next();
- assertEquals("Either wrong language or order parsing: " + locale,
- locale.getLanguage(), "en");
+ assertEquals(locale.getLanguage(), "en",
+ "Either wrong language or order parsing: " + locale);
+
locale = (Locale) tok.next();
- assertEquals("Either wrong language or order parsing: " + locale,
- locale.getLanguage(), "es");
+ assertEquals(locale.getLanguage(), "es",
+ "Either wrong language or order parsing: " + locale);
+
locale = (Locale) tok.next();
- assertEquals("Either wrong country or order parsing: " + locale,
- locale.getCountry(), "TW");
+ assertEquals(locale.getLanguage(), "zh",
+ "Either wrong language or order parsing: " + locale);
}
catch (Exception e)
{
Modified: turbine/fulcrum/trunk/localization/src/test/org/apache/fulcrum/localization/LocalizationTest.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/localization/src/test/org/apache/fulcrum/localization/LocalizationTest.java?rev=1851408&r1=1851407&r2=1851408&view=diff
==============================================================================
--- turbine/fulcrum/trunk/localization/src/test/org/apache/fulcrum/localization/LocalizationTest.java (original)
+++ turbine/fulcrum/trunk/localization/src/test/org/apache/fulcrum/localization/LocalizationTest.java Tue Jan 15 19:31:48 2019
@@ -19,72 +19,56 @@ package org.apache.fulcrum.localization;
* under the License.
*/
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
+
import java.util.Locale;
import java.util.MissingResourceException;
-import org.apache.fulcrum.testcontainer.BaseUnitTest;
+import org.apache.fulcrum.testcontainer.BaseUnit5Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Tests the API of the
* {@link org.apache.fulcrum.localization.LocalizationService}.
- * <br>
*
* @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
* @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
*/
-public class LocalizationTest extends BaseUnitTest
+public class LocalizationTest extends BaseUnit5Test
{
- private LocalizationService ls = null;
- public LocalizationTest(String name)
- {
- super( name );
- }
+ private LocalizationService localizationService = null;
- /**
- * Perform test setup
- *
- * @throws Exception generic exception
- */
+ @BeforeEach
public void setUp() throws Exception
{
- super.setUp();
- try
- {
- ls = (LocalizationService) this.resolve( LocalizationService.class.getName() );
- }
- catch (Throwable e)
- {
- fail(e.getMessage());
- }
+ localizationService = (LocalizationService) lookup(LocalizationService.ROLE);
}
/**
- * Test init
- */
- public void testInitialization()
- {
- assertTrue(true);
- }
-
- /**
* Test localization
* @throws Exception generic exception
*/
+ @Test
public void testLocalization() throws Exception
{
// Test retrieval of text using multiple default bundles
- String s = ls.getString(null, null, "key1");
- assertEquals("Unable to retrieve localized text for locale: default", "value1", s);
- s = ls.getString(null, new Locale("en", "US"), "key2");
- assertEquals("Unable to retrieve localized text for locale: en-US", "value2", s);
- s = ls.getString("org.apache.fulcrum.localization.BarBundle", new Locale("ko", "KR"), "key3");
- assertEquals("Unable to retrieve localized text for locale: ko-KR", s, "[ko] value3");
+ String s = localizationService.getString(null, null, "key1");
+ assertEquals("value1", s, "Unable to retrieve localized text for locale: default");
+
+ s = localizationService.getString(null, new Locale("en", "US"), "key2");
+ assertEquals("value2", s, "Unable to retrieve localized text for locale: en-US");
+
+ s = localizationService.getString("org.apache.fulcrum.localization.BarBundle", new Locale("ko", "KR"), "key3");
+ assertEquals(s, "[ko] value3", "Unable to retrieve localized text for locale: ko-KR");
+
try
{
- ls.getString("DoesNotExist", new Locale("ko", ""), "key1");
+ localizationService.getString("DoesNotExist", new Locale("ko", ""), "key1");
fail();
}
catch (MissingResourceException expectedFailure)
@@ -96,13 +80,15 @@ public class LocalizationTest extends Ba
// should not happen
fail();
}
+
// When a locale is used which cannot be produced for a given
// bundle, fall back to the default locale.
- s = ls.getString(null, new Locale("ko", "KR"), "key4");
- assertEquals("Unable to retrieve localized text for locale: default", s, "value4");
+ s = localizationService.getString(null, new Locale("ko", "KR"), "key4");
+ assertEquals(s, "value4", "Unable to retrieve localized text for locale: default");
+
try
{
- ls.getString(null, null, "NoSuchKey");
+ localizationService.getString(null, null, "NoSuchKey");
fail();
}
catch (MissingResourceException expectedFailure)
@@ -111,7 +97,7 @@ public class LocalizationTest extends Ba
}
}
-
+ @Test
public void testGetString()
{
String key1 = "key1";
@@ -123,23 +109,25 @@ public class LocalizationTest extends Ba
String key4 = "key4";
String value4 = "value4";
- assertEquals(value1, ls.getString(key1));
- assertEquals(value2, ls.getString(key2));
- assertEquals(value3, ls.getString(key3));
- assertEquals(value4, ls.getString(key4));
+ assertEquals(value1, localizationService.getString(key1));
+ assertEquals(value2, localizationService.getString(key2));
+ assertEquals(value3, localizationService.getString(key3));
+ assertEquals(value4, localizationService.getString(key4));
}
/**
- * Putting this in a seperate testcase because it fails.. Why? I don't know. I have never
+ * Putting this in a separate test case because it fails.. Why? I don't know. I have never
* used localization, so I leave it to brains better then mine. -dep
*
* @throws Exception generic exception
*/
+ /*
public void OFFtestRetrievingOddLocale() throws Exception
{
// TODO Figure out why this test fails!
- String s = ls.getString(null, new Locale("fr", "US"), "key3");
- assertEquals("Unable to retrieve localized text for locale: fr", "[fr] value3", s);
+ String s = localizationService.getString(null, new Locale("fr", "US"), "key3");
+ assertEquals("[fr] value3", s, "Unable to retrieve localized text for locale: fr");
}
+ */
}