DataManager { public Single<Balance> getBalance(String accountId) { String token = buildAuthorization(); return mMondroidService.getBalance(token, accountId); } @Inject  DataManager(MondroidService mondroidService, PreferencesHelper preferencesHelper); Single<AccessToken> getAccessToken(String code); Single<Boolean> isUserSignedIn(); Completable signOut(); Single<AccountsResponse> getAccounts(); Single<AccountData> getAccountDetails(); Single<Balance> getBalance(String accountId); Single<List<Transaction>> getTransactions(String accountId);  }
@Test public void getBalanceCompletesAndEmitsBalance() { stubPreferencesHelperGetAccessToken(TestDataFactory.makeAccessToken()); Balance balance = TestDataFactory.makeBalance(); stubMondoServiceGetBalance(Single.just(balance)); TestSubscriber<Balance> testSubscriber = new TestSubscriber<>(); mDataManager.getBalance("account_id").subscribe(testSubscriber); testSubscriber.assertCompleted(); testSubscriber.assertValue(balance); }