You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Emmanuel Bourg <eb...@micropole-univers.com> on 2004/03/04 19:55:38 UTC

[configuration] wrong test for CompositeConfiguration.subset ?

I'm reviewing the subset code and found a confusing test case for 
CompositeConfiguration:

subset = cc.subset("test.short");
assertEquals("1", subset.getString("test.short"));


Is this right ? The "test.short" prefix should be removed from the keys 
in the subset, and unless the key "test.short.test.short" exists in the 
parent configuration, no value should be associated to the "test.short" 
key in the subset and the assertion should fail.

I think the right test is:

subset = cc.subset("test");
assertEquals("1", subset.getString("short"));

Emmanuel Bourg


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


Re: [configuration] wrong test for CompositeConfiguration.subset ?

Posted by Emmanuel Bourg <eb...@micropole-univers.com>.
I have a similar observation for the subset test of 
HierarchicalConfiguration :

   conf = config.subset("tables.table.fields.field.name");
   prop = conf.getProperty("name");
   assertTrue(prop instanceof Collection);
   assertEquals(10, ((Collection) prop).size());

prop should be null, the correct test is:

   conf = config.subset("tables.table.fields.field");
   prop = conf.getProperty("name");
   assertTrue(prop instanceof Collection);
   assertEquals(10, ((Collection) prop).size());

Emmanuel Bourg


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