diff --git a/sdk/common/src/test/java/io/opentelemetry/sdk/common/internal/IncludeExcludePredicateTest.java b/sdk/common/src/test/java/io/opentelemetry/sdk/common/internal/IncludeExcludePredicateTest.java index 5eb6e0a02f7..d1d0859cb34 100644 --- a/sdk/common/src/test/java/io/opentelemetry/sdk/common/internal/IncludeExcludePredicateTest.java +++ b/sdk/common/src/test/java/io/opentelemetry/sdk/common/internal/IncludeExcludePredicateTest.java @@ -162,4 +162,19 @@ private static void shouldIncludeAll( .isEqualTo("IncludeExcludePredicate{globMatchingEnabled=true}"); }); } + + @Test + void shouldExcludeWhenValueMatchesBothIncludeAndExclude() { + String value = "a"; + Collection exactMatchingArg = Collections.singletonList("a"); + + Predicate exactMatching = + IncludeExcludePredicate.createExactMatching(exactMatchingArg, exactMatchingArg); + assertThat(exactMatching.test(value)).isFalse(); + + Collection patternMatchingArg = Collections.singletonList("*"); + Predicate patternMatching = + IncludeExcludePredicate.createPatternMatching(patternMatchingArg, patternMatchingArg); + assertThat(patternMatching.test(value)).isFalse(); + } }