diff --git a/karate-core/src/main/java/com/intuit/karate/StringUtils.java b/karate-core/src/main/java/com/intuit/karate/StringUtils.java index 6e3924d40..4dde22fe2 100644 --- a/karate-core/src/main/java/com/intuit/karate/StringUtils.java +++ b/karate-core/src/main/java/com/intuit/karate/StringUtils.java @@ -260,6 +260,15 @@ public static void removeIgnoreKeyCase(Map map, String name) { } } + public static boolean containsIgnoreCase(List list, String str) { + for (String i : list) { + if (i.equalsIgnoreCase(str)) { + return true; + } + } + return false; + } + public static String throwableToString(Throwable t) { try(final StringWriter sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw, true)) { diff --git a/karate-core/src/main/java/com/intuit/karate/core/Tags.java b/karate-core/src/main/java/com/intuit/karate/core/Tags.java index 46b9a75c9..741cd5876 100644 --- a/karate-core/src/main/java/com/intuit/karate/core/Tags.java +++ b/karate-core/src/main/java/com/intuit/karate/core/Tags.java @@ -132,7 +132,7 @@ public Tags(Collection in) { } public boolean evaluate(String tagSelector, String karateEnv) { - if (tags.contains(Tag.IGNORE)) { + if (StringUtils.containsIgnoreCase(tags, Tag.IGNORE)) { return false; } Values envValues = valuesFor(Tag.ENV); diff --git a/karate-core/src/test/java/com/intuit/karate/StringUtilsTest.java b/karate-core/src/test/java/com/intuit/karate/StringUtilsTest.java index 847db1a43..d23b8cf42 100644 --- a/karate-core/src/test/java/com/intuit/karate/StringUtilsTest.java +++ b/karate-core/src/test/java/com/intuit/karate/StringUtilsTest.java @@ -131,4 +131,12 @@ void testWrappedLinesEstimate() { StringUtils.wrappedLinesEstimate("", 2)); } + @Test + void testContainsIgnoreCase() { + List list = Arrays.asList("foo", "bar"); + assertTrue(StringUtils.containsIgnoreCase(list, "foo")); + assertTrue(StringUtils.containsIgnoreCase(list, "Foo")); + assertFalse(StringUtils.containsIgnoreCase(list, "baz")); + } + }