#1936: Configuration#contains(Ljava/lang/String;)Z
This commit is contained in:
parent
356ca08337
commit
6563a9241b
@ -91,6 +91,11 @@ public final class Configuration
|
|||||||
return ( val != null ) ? (T) val : def;
|
return ( val != null ) ? (T) val : def;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean contains(String path)
|
||||||
|
{
|
||||||
|
return get( path, null ) != null;
|
||||||
|
}
|
||||||
|
|
||||||
public Object get(String path)
|
public Object get(String path)
|
||||||
{
|
{
|
||||||
return get( path, getDefault( path ) );
|
return get( path, getDefault( path ) );
|
||||||
|
@ -94,6 +94,12 @@ public class YamlConfigurationTest
|
|||||||
|
|
||||||
conf.set( "other.new.section", "bar" );
|
conf.set( "other.new.section", "bar" );
|
||||||
Assert.assertEquals( "bar", conf.get( "other.new.section" ) );
|
Assert.assertEquals( "bar", conf.get( "other.new.section" ) );
|
||||||
|
|
||||||
|
Assert.assertTrue( conf.contains( "customer.given" ) );
|
||||||
|
Assert.assertTrue( customer.contains( "given" ) );
|
||||||
|
|
||||||
|
Assert.assertFalse( conf.contains( "customer.foo" ) );
|
||||||
|
Assert.assertFalse( customer.contains( "foo" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user