### Question:
LogGeneration extends AbstractLogDir implements Comparable<LogGeneration> { @Override public int compareTo(@Nonnull LogGeneration o) { return Integer.compare(lastIncludedIndex, o.lastIncludedIndex); } LogGeneration(File baseDir, int lastIncludedIndex);   LogGeneration(File dir); int getLastIncludedIndex(); @Override int compareTo(@Nonnull LogGeneration o); @Override String toString();  }### Answer:
@Test public void testCompare() { File baseDir = new File("data"); LogGeneration generation = new LogGeneration(baseDir, 10); Assert.assertEquals(1, generation.compareTo(new LogGeneration(baseDir, 9))); Assert.assertEquals(0, generation.compareTo(new LogGeneration(baseDir, 10))); Assert.assertEquals(-1, generation.compareTo(new LogGeneration(baseDir, 11))); }