### Question:
LogGeneration extends AbstractLogDir implements Comparable<LogGeneration> { static boolean isValidDirName(String dirName) { return DIR_NAME_PATTERN.matcher(dirName).matches(); } LogGeneration(File baseDir, int lastIncludedIndex);   LogGeneration(File dir); int getLastIncludedIndex(); @Override int compareTo(@Nonnull LogGeneration o); @Override String toString();  }### Answer:
@Test public void isValidDirName() { Assert.assertTrue(LogGeneration.isValidDirName("log-0")); Assert.assertTrue(LogGeneration.isValidDirName("log-12")); Assert.assertTrue(LogGeneration.isValidDirName("log-123")); Assert.assertFalse(LogGeneration.isValidDirName("log-")); Assert.assertFalse(LogGeneration.isValidDirName("foo")); Assert.assertFalse(LogGeneration.isValidDirName("foo-0")); }