@Test
public void getAllThreadsMatching() {

    // try various regular expressions
    Thread[] allThreads0 = ThreadUtil.getAllThreadsMatching("main");
    Assert.assertEquals(1, allThreads0.length);
    Thread[] allThreads1 = ThreadUtil.getAllThreadsMatching("(?i).*Main.*");
    Assert.assertEquals(1, allThreads1.length);
    // the two previous should match
    Assert.assertEquals(allThreads0[0].getId(), allThreads1[0].getId());
    Thread[] allThreads2 = ThreadUtil.getAllThreadsMatching(".*main.*");
    Assert.assertEquals(1, allThreads2.length);
    // the two previous should match
    Assert.assertEquals(allThreads0[0].getId(), allThreads2[0].getId());
    
    // no matches
    Thread[] allThreads3 = ThreadUtil.getAllThreadsMatching(".*Main.*");
    Assert.assertEquals(0, allThreads3.length);
}