Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.5.4
-
None
-
None
-
windows xp
Description
- I created the following Groovy test:
import java.io.IOException; public class PropertyParsingTest extends GroovyTestCase { public void test() throws IOException{ ConfigSlurper configSlurper = new ConfigSlurper() Properties props = new Properties() props.load(PropertyParsingTest.class.getResourceAsStream("system.properties")) ConfigObject newConfig = configSlurper.parse(props) props = newConfig.toProperties() assertEquals("false", props.get("catalog.prov")) assertEquals("sa", props.get("catalog.prov.db.user")) } }
- I created system.properties file and put it to into classpath:
catalog.prov = false catalog.prov.db.user = sa
I got the following exception:
There was 1 failure:
1) test(PropertyParsingTest)junit.framework.ComparisonFailure: expected:<sa> but was:<null>
at groovy.util.GroovyTestCase.assertEquals(GroovyTestCase.java:393)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:899)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN(ScriptBytecodeAdapter.java:77)
at PropertyParsingTest.test(PropertyParsingTest.groovy:13)