### Question:
Period implements Comparable<Period> { @Override public int compareTo(@Nonnull Period o) { int comparison = compareNullableDates(endDate, o.endDate); if (comparison != 0) return comparison; comparison = compareNullableDates(beginDate, o.beginDate); if (comparison != 0) return comparison; if (lastPeriod == o.lastPeriod) return 0; else if (lastPeriod) return -1; else return 1; } Period(final LocalDate beginDate, final LocalDate endDateExclusive);  Period(final LocalDate beginDate, final LocalDate endDateExclusive, final boolean lastPeriod);  Period(final LocalDate beginDate, final int periodLength);  Period(final int periodLength, final LocalDate endDate); LocalDate getBeginDate(); LocalDate getEndDate(); boolean isLastPeriod(); Duration getDuration(); @Override boolean equals(Object o); @Override int hashCode(); @Override int compareTo(@Nonnull Period o); @Override String toString();  }### Answer:
@Test public void compareTo() throws Exception { final Period yesterdayPeriod = new Period(yesterday, today); final Period todayPeriod = new Period(today, tommorrow); final Period tommorrowPeriod = new Period(tommorrow, dayAfterTommorrow); Assert.assertTrue(yesterdayPeriod.compareTo(todayPeriod) < 0); Assert.assertTrue(todayPeriod.compareTo(todayPeriod) == 0); Assert.assertTrue(tommorrowPeriod.compareTo(todayPeriod) > 0); }