### Question:
Options { public static <T> Mapper<Option<T>, T> toValue() { return new Mapper<Option<T>, T>() { @Override public T map(Option<T> input) { return input.getValue(); } }; }  static Iterable<Option<T>> somes(Iterable<Option<T>> options); static Iterable<Option<T>> nones(Iterable<Option<T>> options); static Predicate<Option<T>> isSome(); static Predicate<Option<T>> isNone(); static Predicate<Option<T>> hasValue(); static Predicate<Option<T>> hasNoValue(); static Mapper<Option<T>, T> toValue(); static Mapper<Option<T>, T> toValue(
            @SuppressWarnings("unused") Class<T> valueClass); static Iterable<T> flatten(Iterable<Option<T>> options);  }### Answer:
@Test public void returnsMapperThatConvertsOptionToValue() { Option<String> option = some("string"); String value = Options.<String>toValue().map(option); assertThat(value, is("string")); }
@Test(expected = NoSuchElementException.class) public void throwsExceptionWhenOptionPassedToToValueMapperIsNone() { Option<String> option = none(); String value = Options.<String>toValue().map(option); }
@Test public void returnsMapperThatConvertsOptionToValueOfSpecifiedType() { Option<String> option = some("string"); String value = Options.toValue(String.class).map(option); assertThat(value, is("string")); }
@Test(expected = NoSuchElementException.class) public void throwsExceptionWhenOptionPassedToToValueMapperOfTypeIsNone() { Option<String> option = none(); String value = Options.toValue(String.class).map(option); }