@ -17,6 +17,7 @@
package org.springframework.boot.actuate.autoconfigure.health ;
import java.util.Arrays ;
import java.util.Collections ;
import java.util.LinkedHashSet ;
import java.util.Set ;
import java.util.function.Predicate ;
@ -29,13 +30,14 @@ import static org.assertj.core.api.Assertions.assertThat;
* Tests for { @link IncludeExcludeGroupMemberPredicate } .
*
* @author Phillip Webb
* @author Madhura Bhave
* /
class IncludeExcludeGroupMemberPredicateTests {
@Test
void testWhenEmptyIncludeAndExclude Rejec tsAll( ) {
void testWhenEmptyIncludeAndExclude Accep tsAll( ) {
Predicate < String > predicate = new IncludeExcludeGroupMemberPredicate ( null , null ) ;
assertThat ( predicate ) . rejec ts( "a" , "b" , "c" ) ;
assertThat ( predicate ) . accep ts( "a" , "b" , "c" ) ;
}
@Test
@ -44,6 +46,12 @@ class IncludeExcludeGroupMemberPredicateTests {
assertThat ( predicate ) . accepts ( "a" , "b" , "c" ) ;
}
@Test
void testWhenEmptyIncludeAndNonEmptyExcludeAcceptsAllButExclude ( ) {
Predicate < String > predicate = new IncludeExcludeGroupMemberPredicate ( null , Collections . singleton ( "c" ) ) ;
assertThat ( predicate ) . accepts ( "a" , "b" ) ;
}
@Test
void testWhenStarIncludeAndSpecificExcludeDoesNotAcceptExclude ( ) {
Predicate < String > predicate = include ( "*" ) . exclude ( "c" ) ;