AuthSubscription { public Subscription buildAndSubscribe() { checkArgumentsConsistency(); Observable<AuthToken> observable = buildObservable(); subscription = observable .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new AuthObserver(activity, callback)); return subscription; } AuthSubscription(); AuthSubscription setEmail(String email); AuthSubscription setAccount(Account account); AuthSubscription setScope(String scope); AuthSubscription setActivity(Activity activity); AuthSubscription setCallback(AuthCallback callback); Subscription buildAndSubscribe(); void cancelPreviousSubscription();  }
@Test public void shouldCreateNewSubscription() throws Exception { Subscription mockSubscription = mock(Subscription.class); sut.subscription = mockSubscription; sut.buildAndSubscribe(); assertNotSame(sut.subscription, mockSubscription); }