package com.autonomy.abc.matchers;

import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import static org.hamcrest.Matchers.anyOf;

public class StringMatchers {
    public static Matcher<String> stringContainingAnyOf(final Iterable<? extends Serializable> strings) {
        final List<Matcher<? super String>> matchers = new ArrayList<>();
        for (Serializable string : strings) {
            matchers.add(containsString(string));
        }
        return new TypeSafeMatcher<String>() {
            @Override
            protected boolean matchesSafely(String s) {
                return anyOf(matchers).matches(s);
            }

            @Override
            public void describeTo(Description description) {
                description
                        .appendText("a string containing any of ")
                        .appendValue(strings);
            }
        };
    }

    public static Matcher<String> stringContainingAnyOf(final Serializable[] strings) {
        return stringContainingAnyOf(Arrays.asList(strings));
    }

    public static Matcher<String> containsString(Serializable stringLike) {
        return org.hamcrest.Matchers.containsString(stringLike.toString());
    }
}

@@ -211,16 +211,45 @@
 Arrays;%0A
+import java.util.Comparator;%0A
 import j
@@ -1387,11 +1387,645 @@
 );%0A    %7D
+%0A%0A    public static Matcher%3CString%3E containsIgnoringCase(final Serializable stringLike) %7B%0A        return new TypeSafeMatcher%3CString%3E() %7B%0A            @Override%0A            protected boolean matchesSafely(String s) %7B%0A                return s != null && s.toLowerCase().contains(stringLike.toString().toLowerCase());%0A            %7D%0A%0A            @Override%0A            public void describeTo(Description description) %7B%0A                description%0A                        .appendText(%22a string containing %22)%0A                        .appendValue(stringLike)%0A                        .appendText(%22ignoring case%22);%0A            %7D%0A        %7D;%0A    %7D
 %0A%7D%0A

Add containsIgnoringCase matcher