Skip to content

Commit f3626ff

Browse files
committed
add IncludeExcludePredicate test when value matches both include and exclude
1 parent b1b563b commit f3626ff

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

sdk/common/src/test/java/io/opentelemetry/sdk/common/internal/IncludeExcludePredicateTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,19 @@ private static void shouldIncludeAll(
162162
.isEqualTo("IncludeExcludePredicate{globMatchingEnabled=true}");
163163
});
164164
}
165+
166+
@Test
167+
void shouldExcludeWhenValueMatchesBothIncludeAndExclude() {
168+
String value = "a";
169+
Collection<String> exactMatchingArg = Collections.singletonList("a");
170+
171+
Predicate<String> exactMatching =
172+
IncludeExcludePredicate.createExactMatching(exactMatchingArg, exactMatchingArg);
173+
assertThat(exactMatching.test(value)).isFalse();
174+
175+
Collection<String> patternMatchingArg = Collections.singletonList("*");
176+
Predicate<String> patternMatching =
177+
IncludeExcludePredicate.createPatternMatching(patternMatchingArg, patternMatchingArg);
178+
assertThat(patternMatching.test(value)).isFalse();
179+
}
165180
}

0 commit comments

Comments
 (0)