Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Commit

Permalink
SpigotMC#1936: Configuration#contains(Ljava/lang/String;)Z
Browse files Browse the repository at this point in the history
  • Loading branch information
md-5 committed Aug 20, 2016
1 parent 356ca08 commit 6563a92
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ public <T> T get(String path, T def)
return ( val != null ) ? (T) val : def;
}

public boolean contains(String path)
{
return get( path, null ) != null;
}

public Object get(String path)
{
return get( path, getDefault( path ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ private void testSection(Configuration conf)

conf.set( "other.new.section", "bar" );
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
Expand Down

0 comments on commit 6563a92

Please sign in to comment.