bloritsch 01/10/31 11:13:18
Modified: src/scratchpad/org/apache/avalon/excalibur/i18n
AbstractBundle.java
src/scratchpad/org/apache/avalon/excalibur/i18n/test
AbstractBundleTestCase.java
Log:
Fix Bundle tests
Revision Changes Path
1.2 +1 -1
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/i18n/AbstractBundle.java
Index: AbstractBundle.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/i18n/AbstractBundle.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractBundle.java 2001/10/30 21:38:56 1.1
+++ AbstractBundle.java 2001/10/31 19:13:18 1.2
@@ -97,7 +97,7 @@
* @exception MissingResourceException if value was not found
*/
public String getString(String key, Map variables) {
- return convertKey(getString(key));
+ return convertKey(substitute(getString(key), variables));
}
/**
1.2 +12 -7
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/i18n/test/AbstractBundleTestCase.java
Index: AbstractBundleTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/i18n/test/AbstractBundleTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractBundleTestCase.java 2001/10/31 12:30:42 1.1
+++ AbstractBundleTestCase.java 2001/10/31 19:13:18 1.2
@@ -19,7 +19,7 @@
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Neeme Praks</a>
- * @version $Id: AbstractBundleTestCase.java,v 1.1 2001/10/31 12:30:42 neeme
Exp $
+ * @version $Id: AbstractBundleTestCase.java,v 1.2 2001/10/31 19:13:18
bloritsch Exp $
*/
public class AbstractBundleTestCase extends TestCase {
@@ -42,15 +42,20 @@
this.bundle.put("test.empty", "");
}
+ public void tearDown() throws Exception {
+ this.variables.clear();
+ this.bundle.store.clear();
+ }
+
public void testSubstitute() {
- assertTrue(this.bundle.getString("nice", variables),
this.bundle.getString("nice", variables).equals("This is a not so nice test!"));
- assertTrue(this.bundle.getString("nice.nice", variables),
this.bundle.getString("nice.nice", variables).equals("This is a not so nice,
not so nice test!"));
- assertTrue(this.bundle.getString("nice.bad", variables),
this.bundle.getString("nice.bad", variables).equals("This is a not so nice but
not too bad test!"));
- assertTrue(this.bundle.getString("test.plain", variables),
this.bundle.getString("test.plain", variables).equals("This is a test!"));
- assertTrue(this.bundle.getString("test.empty", variables),
this.bundle.getString("test.empty", variables).equals(""));
+ assertEquals(this.bundle.getString("test.plain", variables), "This
is a test!", this.bundle.getString("test.plain", variables));
+ assertEquals(this.bundle.getString("test.empty", variables), "",
this.bundle.getString("test.empty", variables));
+ assertEquals(this.bundle.getString("nice", variables), "This is a
not so nice test!", this.bundle.getString("nice", variables));
+ assertEquals(this.bundle.getString("nice.nice", variables), "This is
a not so nice, not so nice test!", this.bundle.getString("nice.nice",
variables));
+ assertEquals(this.bundle.getString("nice.bad", variables), "This is
a not so nice but not too bad test!", this.bundle.getString("nice.bad",
variables));
}
- private class TestBundle extends AbstractBundle {
+ private static class TestBundle extends AbstractBundle {
private Map store = new HashMap();
public void init(String fileName, boolean cacheAtStartup) throws
Exception {
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>