@Test public void testUnavailable() { OptionalService<Object> optionalService = OptionalService.unavailable("abc"); assertThat(optionalService.getAvailability().getAvailable()).isFalse(); assertThat(optionalService.getAvailability().getReason()).isEqualTo("abc"); }
static <T> OptionalService<T> unavailable(String reason) { return new AbsentOptionalService<T>(reason); }
OptionalService { static <T> OptionalService<T> unavailable(String reason) { return new AbsentOptionalService<T>(reason); } }
OptionalService { static <T> OptionalService<T> unavailable(String reason) { return new AbsentOptionalService<T>(reason); }  }
OptionalService { static <T> OptionalService<T> unavailable(String reason) { return new AbsentOptionalService<T>(reason); }  abstract Availability getAvailability(); abstract @Nullable T getService(); }
OptionalService { static <T> OptionalService<T> unavailable(String reason) { return new AbsentOptionalService<T>(reason); }  abstract Availability getAvailability(); abstract @Nullable T getService();  }