@Test
public void fileNameDateTimeComparatorClass() throws Exception {

    //
    // create sample directory with a couple entries
    //
    File targetDir = new File("target/sample/fileNameDateTimeComparatorClass");
    targetDir.mkdirs();
    File file0 = new File(targetDir, "sample1-2009-06-25.log");
    file0.createNewFile();
    File file1 = new File(targetDir, "sample2-2009-06-23.log");
    file1.createNewFile();
    File file2 = new File(targetDir, "sample3-2009-06-24.log");
    file2.createNewFile();
    //
    // alphabetically, these files should actually go sample1, sample2, then sample3
    // but if we sort by the embedded date, they shoudl go sample2, sample3, then sample1
    //
    // try 1 extension
    File[] files = FileUtil.findFiles(targetDir, new FileNameDateTimeFilter(new DateTime(2009,6,25,0,0,0,0,DateTimeZone.UTC)));
    // sort by embedded date
    Arrays.sort(files, new FileUtil.FileNameDateTimeComparator("yyyy-MM-dd", DateTimeZone.UTC));
    Assert.assertEquals(3, files.length);
    Assert.assertEquals(file1, files[0]);
    Assert.assertEquals(file2, files[1]);
    Assert.assertEquals(file0, files[2]);
}