### Question:
Ordinal implements Comparable<Ordinal> { public static Ordinal of(int oneBased) { return oneBased > 0 && oneBased <= FIRST.length ? FIRST[oneBased - 1] : new Ordinal(oneBased); } private  Ordinal(int num); static Ordinal first(); static Stream<Ordinal> natural(); static Ordinal of(int oneBased); static Ordinal fromIndex(int zeroBased); int toIndex(); Ordinal next(); @Override int compareTo(Ordinal that); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }### Answer:
@Test public void invalidOrdinal() { assertThrows(IllegalArgumentException.class, () -> Ordinal.of(0)); assertThrows(IllegalArgumentException.class, () -> Ordinal.of(-1)); }
@Test public void of() { for (int i = 1; i < 1000; i++) { assertThat(Ordinal.of(i).toIndex()).isEqualTo(i - 1); } }