@Test
public void testRegexFileNameFiltering() throws IOException {

  append("a.log");
  append("a.log.1");
  append("b.log");
  append("c.log.yyyy.MM-01");
  append("c.log.yyyy.MM-02");
  // Tail a.log and b.log
  TaildirMatcher tm1 = new TaildirMatcher("ab",
                                          tmpDir.getAbsolutePath() + File.separator + "[ab].log",
                                          isCachingNeeded);
  // Tail files that starts with c.log
  TaildirMatcher tm2 = new TaildirMatcher("c",
                                          tmpDir.getAbsolutePath() + File.separator + "c.log.*",
                                          isCachingNeeded);
  List<String> files1 = filesToNames(tm1.getMatchingFiles());
  List<String> files2 = filesToNames(tm2.getMatchingFiles());
  assertEquals(2, files1.size());
  assertEquals(2, files2.size());
  // Make sure we got every file
  assertTrue("Regex pattern for ab should have matched a.log file",
             files1.contains("a.log"));
  assertFalse("Regex pattern for ab should NOT have matched a.log.1 file",
              files1.contains("a.log.1"));
  assertTrue("Regex pattern for ab should have matched b.log file",
             files1.contains("b.log"));
  assertTrue("Regex pattern for c should have matched c.log.yyyy-MM-01 file",
             files2.contains("c.log.yyyy.MM-01"));
  assertTrue("Regex pattern for c should have matched c.log.yyyy-MM-02 file",
             files2.contains("c.log.yyyy.MM-02"));
}