@ParameterizedTest @ArgumentsSource(TestCaseArgumentsProvider.class) @TestCase({"null", "empty"}) @TestCase({"", "empty"}) @TestCase({"\n", "empty"}) @TestCase({" ", "empty"}) @TestCase({"\f\r\n ", "empty"}) @TestCase({"x", "x"}) void ofBlankable(String input, Optional<String> expected) { Optional<String> result = OptionalUtil.ofBlankable(input); assertThat(result, is(expected)); }
public static <T extends CharSequence> Optional<T> ofBlankable(T s) { return StringUtils.isBlank(s) ? Optional.empty() : Optional.of(s); }
OptionalUtil extends UtilityClass { public static <T extends CharSequence> Optional<T> ofBlankable(T s) { return StringUtils.isBlank(s) ? Optional.empty() : Optional.of(s); } }
OptionalUtil extends UtilityClass { public static <T extends CharSequence> Optional<T> ofBlankable(T s) { return StringUtils.isBlank(s) ? Optional.empty() : Optional.of(s); }  }
OptionalUtil extends UtilityClass { public static <T extends CharSequence> Optional<T> ofBlankable(T s) { return StringUtils.isBlank(s) ? Optional.empty() : Optional.of(s); }  static Optional<T> ofBlankable(T s); static Optional<T> ofOnly(Iterable<T> iterable); static OptionalWrapper<T> with(Optional<T> optional); static Optional<T> or(Optional<T> optional, Optional<T> other); static Optional<T> orGet(Optional<T> optional, Supplier<? extends Optional<? extends T>> supplier); static Optional<U> as(Class<U> targetClass, Optional<T> source); @SuppressWarnings("unchecked") static Optional<U> as(TypeToken<U> targetType, Optional<T> source); static Optional<U> as(Class<U> targetClass, T source); @SuppressWarnings("unchecked") static Optional<U> as(TypeToken<U> targetType, T source); }
OptionalUtil extends UtilityClass { public static <T extends CharSequence> Optional<T> ofBlankable(T s) { return StringUtils.isBlank(s) ? Optional.empty() : Optional.of(s); }  static Optional<T> ofBlankable(T s); static Optional<T> ofOnly(Iterable<T> iterable); static OptionalWrapper<T> with(Optional<T> optional); static Optional<T> or(Optional<T> optional, Optional<T> other); static Optional<T> orGet(Optional<T> optional, Supplier<? extends Optional<? extends T>> supplier); static Optional<U> as(Class<U> targetClass, Optional<T> source); @SuppressWarnings("unchecked") static Optional<U> as(TypeToken<U> targetType, Optional<T> source); static Optional<U> as(Class<U> targetClass, T source); @SuppressWarnings("unchecked") static Optional<U> as(TypeToken<U> targetType, T source);  }