Functions1 { @Nonnull public static Func1<? super CharSequence, Boolean> isNullOrEmpty() { return new Func1<CharSequence, Boolean>() { @Override public Boolean call(CharSequence charSequence) { return charSequence == null || charSequence.length() == 0; } }; }  @Nonnull static Func1<? super Boolean, Boolean> isTrue(); @Nonnull static Func1<? super Boolean, Boolean> isFalse(); @Nonnull static Func1<T, Boolean> neg(@Nonnull final Func1<T, Boolean> func1); @Nonnull static Func1<? super Object, Boolean> isNull(); @Nonnull static Func1<? super Object, Boolean> isNotNull(); @Nonnull static Func1<? super CharSequence, Boolean> isNullOrEmpty(); @Nonnull static Func1<? super Object, Boolean> instanceOf(@Nonnull final Class clazz); @Nonnull static Func1<? super Object, ?> toObject(); @Nonnull static Func1<? super Object, Void> toVoid(); @Nonnull static Func1<? super Boolean, ? extends Boolean> neg(); @Nonnull static Func1<Object, Boolean> returnFalse(); @Nonnull static Func1<Object, Boolean> returnTrue(); @Nonnull static Func1<Object, T> returnJust(final T value); @Deprecated @Nonnull static Func1<? super CharSequence, String> charSequenceToString(); @Nonnull static Func1<Object, String> toStringFunction(); @Nonnull static Func1<? super Object, Boolean> isEqualTo(@Nonnull final Object... values);  }
@Test public void testIsNullOrEmpty_null() throws Exception { final TestSubscriber<Boolean> isNullOrEmptyResult = new TestSubscriber<>(); Observable.just((String) null) .map(Functions1.isNullOrEmpty()) .subscribe(isNullOrEmptyResult); assert_().that(isNullOrEmptyResult.getOnNextEvents()).containsExactly(true); }
@Test public void testIsNullOrEmpty_emptyString() throws Exception { final TestSubscriber<Boolean> isNullOrEmptyResult = new TestSubscriber<>(); Observable.just("") .map(Functions1.isNullOrEmpty()) .subscribe(isNullOrEmptyResult); assert_().that(isNullOrEmptyResult.getOnNextEvents()).containsExactly(true); }
@Test public void testIsNullOrEmpty_nonEmptyString() throws Exception { final TestSubscriber<Boolean> isNullOrEmptyResult = new TestSubscriber<>(); Observable.just("Super string!") .map(Functions1.isNullOrEmpty()) .subscribe(isNullOrEmptyResult); assert_().that(isNullOrEmptyResult.getOnNextEvents()).containsExactly(false); }