### Question:
SubscriptionUtils { @NonNull public static Disposable subscribeTextViewText(@NonNull final Observable<String> observable, @NonNull final TextView textView) { return subscribeTextViewText(observable, textView, AndroidSchedulers.mainThread()); } private  SubscriptionUtils(); @NonNull static Disposable subscribeTextViewText(@NonNull final Observable<String> observable,
                                                   @NonNull final TextView textView); @NonNull static Disposable subscribeTextViewText(@NonNull final Observable<String> observable,
                                                   @NonNull final TextView textView,
                                                   @NonNull final Scheduler scheduler);  }### Answer:
@Test public void testTextViewIsUpdatedWhenValueComes() { TextView textView = mock(TextView.class); Observable<String> observable = Observable.just("String"); SubscriptionUtils.subscribeTextViewText(observable, textView); verify(textView).setText(eq("String")); }
@Test public void testTextViewIsUpdatedWithErrorMessageOnError() { TextView textView = mock(TextView.class); Observable<String> observable = Observable.error(new NullPointerException()); SubscriptionUtils.subscribeTextViewText(observable, textView); verify(textView).setText(contains("NullPointerException")); verify(textView).setBackgroundColor(eq(Color.RED)); }