@Test
public void countMatches() {

    assertEquals(0, StringUtil.countMatches(null, "a"));
    assertEquals(0, StringUtil.countMatches("", "a"));
    assertEquals(0, StringUtil.countMatches("abba", null));
    assertEquals(0, StringUtil.countMatches("abba", ""));
    assertEquals(2, StringUtil.countMatches("abba", "a"));
    assertEquals(1, StringUtil.countMatches("abba", "ab"));
    assertEquals(0, StringUtil.countMatches("abba", "xxx"));
    assertEquals(3, StringUtil.countMatches("xxx{}yyy{},...zzz{}aaa", "{}"));
}