Optional { @SuppressWarnings("unchecked") public static <T> Optional<T> absent() { return (Optional<T>) Absent.INSTANCE; }  @SuppressWarnings("unchecked") static Optional<T> absent(); static Optional<T> of(T reference); abstract boolean isPresent(); abstract T get(); abstract T or(T defaultValue); @CheckForNull abstract T orNull();  }
@Test public void absent() { assertThat(absent.isPresent()).isFalse(); assertThat(absent.orNull()).isNull(); assertThat(absent.or("bar")).isSameAs("bar"); assertThat(absent.toString()).isEqualTo("Optional.absent()"); assertThat(absent.equals(present)).isFalse(); assertThat(absent.equals(absent)).isTrue(); assertThat(absent.hashCode()).isEqualTo(0x598df91c); thrown.expect(IllegalStateException.class); thrown.expectMessage("value is absent"); absent.get(); }