From f3626ff00de4377257b7b8ff3bedcc335fad3d57 Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 5 May 2026 11:30:15 +0200 Subject: [PATCH] add IncludeExcludePredicate test when value matches both include and exclude --- .../internal/IncludeExcludePredicateTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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(); + } }