dlr 02/01/31 11:21:12
Added: util/src/test/org/apache/commons/util
FastPropertyResourceBundle.test.conf
FastPropertyResourceBundleTest.java
Log:
Test from leandro.
Revision Changes Path
1.1
jakarta-commons-sandbox/util/src/test/org/apache/commons/util/FastPropertyResourceBundle.test.conf
Index: FastPropertyResourceBundle.test.conf
===================================================================
key1=value1
key2=value2
1.1
jakarta-commons-sandbox/util/src/test/org/apache/commons/util/FastPropertyResourceBundleTest.java
Index: FastPropertyResourceBundleTest.java
===================================================================
package org.apache.commons.util;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.framework.Test;
import junit.framework.Assert;
import java.io.InputStream;
import java.io.FileInputStream;
import java.util.Enumeration;
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Leandro Rodrigo Saad Cruz</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
*/
public class FastPropertyResourceBundleTest
extends TestCase
{
protected static final String RESOURCE_NAME =
"org/apache/commons/util/FastPropertyResourceBundle.test.conf";
FastPropertyResourceBundle rb;
Object first;
Object second;
public FastPropertyResourceBundleTest(String name)
{
super(name);
}
protected void setUp()
throws Exception
{
ClassLoader loader = getClass().getClassLoader();
InputStream in = loader.getResourceAsStream(RESOURCE_NAME);
rb = new FastPropertyResourceBundle(in);
first = new String("value1");
second = new String("value2");
}
protected void tearDown()
{
}
public void testFileContents()
{
Assert.assertTrue(rb.getString("key1").equals(first));
Assert.assertTrue(!rb.getString("key1").equals(second));
Assert.assertTrue(rb.getString("key2").equals(second));
Assert.assertTrue(!rb.getString("key2").equals(first));
}
public void testCacheSize()
{
Enumeration enum = rb.getKeys();
int count = 0;
while(enum.hasMoreElements())
{
count++;
enum.nextElement();
}
Assert.assertTrue(2 == count);
}
public static Test suite()
{
return new TestSuite(FastPropertyResourceBundleTest.class);
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>