You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by eb...@apache.org on 2004/06/21 17:35:15 UTC

cvs commit: jakarta-commons/configuration/src/test/org/apache/commons/configuration TestJNDIEnvironmentValues.java

ebourg      2004/06/21 08:35:15

  Modified:    configuration/src/test/org/apache/commons/configuration
                        TestJNDIEnvironmentValues.java
  Log:
  Added a test for getKeys(String)
  
  Revision  Changes    Path
  1.6       +15 -10    jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestJNDIEnvironmentValues.java
  
  Index: TestJNDIEnvironmentValues.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestJNDIEnvironmentValues.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestJNDIEnvironmentValues.java	2 Jun 2004 17:18:01 -0000	1.5
  +++ TestJNDIEnvironmentValues.java	21 Jun 2004 15:35:15 -0000	1.6
  @@ -1,5 +1,3 @@
  -package org.apache.commons.configuration;
  -
   /*
    * Copyright 2002-2004 The Apache Software Foundation.
    *
  @@ -16,6 +14,8 @@
    * limitations under the License.
    */
   
  +package org.apache.commons.configuration;
  +
   import java.util.Iterator;
   import java.util.NoSuchElementException;
   
  @@ -25,7 +25,8 @@
   {
       private JNDIConfiguration conf = null;
   
  -    public void setUp() throws Exception{
  +    public void setUp() throws Exception
  +    {
           System.setProperty("java.naming.factory.initial","org.apache.commons.configuration.MockStaticMemoryInitialContextFactory");
           
           conf = new JNDIConfiguration();
  @@ -78,16 +79,13 @@
           assertNull("'test.short' property not cleared", conf.getShort("test.short", null));
       }
       
  -    public void testIsEmpty() {
  +    public void testIsEmpty()
  +    {
           assertFalse("the configuration shouldn't be empty", conf.isEmpty());
       }
       
  -    /**
  -     * Currently failing in that we don't get back any keys!
  -     * @throws Exception
  -     */
  -    public void testGetKeys() throws Exception {
  -
  +    public void testGetKeys() throws Exception
  +    {
           boolean found = false;
           Iterator it = conf.getKeys();
   
  @@ -99,4 +97,11 @@
   
           assertTrue("'test.boolean' key not found", found);
       }
  +
  +    public void testGetKeysWithPrefix()
  +    {
  +        Iterator it = conf.getKeys("foo.bar");
  +        assertFalse("no key should be found", it.hasNext());
  +    }
  +
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org