@Test public void testGetCoinMarketCap_exception() { when(eosManager.getMarketPrice(anyString())).thenReturn(Single.create(emitter -> { emitter.onError(new IOException()); })); presenter.getMarketPrice(Constants.EOS_COINMARKETCAP_ID); testScheduler.triggerActions(); verify(view, times(1)).noMarketPrice(); }
public void getMarketPrice(@NonNull String id) { mEosManager.getMarketPrice(id) .subscribeOn(mRxJavaSchedulers.getIo()) .observeOn(mRxJavaSchedulers.getMainThread()) .subscribe(coinMarketCapData -> { if (coinMarketCapData.data == null) { mView.noMarketPrice(); } else { mView.setMarketPrice(coinMarketCapData); } }, e -> { e.printStackTrace(); mView.noMarketPrice(); }); }
BalancePresenter extends BasePresenter<BalanceView> { public void getMarketPrice(@NonNull String id) { mEosManager.getMarketPrice(id) .subscribeOn(mRxJavaSchedulers.getIo()) .observeOn(mRxJavaSchedulers.getMainThread()) .subscribe(coinMarketCapData -> { if (coinMarketCapData.data == null) { mView.noMarketPrice(); } else { mView.setMarketPrice(coinMarketCapData); } }, e -> { e.printStackTrace(); mView.noMarketPrice(); }); } }
BalancePresenter extends BasePresenter<BalanceView> { public void getMarketPrice(@NonNull String id) { mEosManager.getMarketPrice(id) .subscribeOn(mRxJavaSchedulers.getIo()) .observeOn(mRxJavaSchedulers.getMainThread()) .subscribe(coinMarketCapData -> { if (coinMarketCapData.data == null) { mView.noMarketPrice(); } else { mView.setMarketPrice(coinMarketCapData); } }, e -> { e.printStackTrace(); mView.noMarketPrice(); }); } BalancePresenter(BalanceView view, EosManager eosManager, PocketAppManager pocketAppManager,
            CustomPreference customPreference, RxJavaSchedulers rxJavaSchedulers); }
BalancePresenter extends BasePresenter<BalanceView> { public void getMarketPrice(@NonNull String id) { mEosManager.getMarketPrice(id) .subscribeOn(mRxJavaSchedulers.getIo()) .observeOn(mRxJavaSchedulers.getMainThread()) .subscribe(coinMarketCapData -> { if (coinMarketCapData.data == null) { mView.noMarketPrice(); } else { mView.setMarketPrice(coinMarketCapData); } }, e -> { e.printStackTrace(); mView.noMarketPrice(); }); } BalancePresenter(BalanceView view, EosManager eosManager, PocketAppManager pocketAppManager,
            CustomPreference customPreference, RxJavaSchedulers rxJavaSchedulers); @Override void onCreate(); void getTokens(@NonNull String accountName); void getAccount(@NonNull String accountName); @Override void onPause(); @Override void onResume(); @Override void onDestroy(); void getEosBalance(@NonNull EosAccountModel eosAccountModel); void getTokenBalance(@NonNull String account, @NonNull String code, @NonNull String symbol); void getMarketPrice(@NonNull String id); void setTokenAdapterDataModel(@NonNull AdapterDataModel<TokenItem> tokenAdapterDataModel); void setTransferAdapterDataModel(@NonNull AdapterDataModel<TransferItem> transferAdapterDataModel); void getTransfers(@NonNull String accountName, int page, int perPage); }
BalancePresenter extends BasePresenter<BalanceView> { public void getMarketPrice(@NonNull String id) { mEosManager.getMarketPrice(id) .subscribeOn(mRxJavaSchedulers.getIo()) .observeOn(mRxJavaSchedulers.getMainThread()) .subscribe(coinMarketCapData -> { if (coinMarketCapData.data == null) { mView.noMarketPrice(); } else { mView.setMarketPrice(coinMarketCapData); } }, e -> { e.printStackTrace(); mView.noMarketPrice(); }); } BalancePresenter(BalanceView view, EosManager eosManager, PocketAppManager pocketAppManager,
            CustomPreference customPreference, RxJavaSchedulers rxJavaSchedulers); @Override void onCreate(); void getTokens(@NonNull String accountName); void getAccount(@NonNull String accountName); @Override void onPause(); @Override void onResume(); @Override void onDestroy(); void getEosBalance(@NonNull EosAccountModel eosAccountModel); void getTokenBalance(@NonNull String account, @NonNull String code, @NonNull String symbol); void getMarketPrice(@NonNull String id); void setTokenAdapterDataModel(@NonNull AdapterDataModel<TokenItem> tokenAdapterDataModel); void setTransferAdapterDataModel(@NonNull AdapterDataModel<TransferItem> transferAdapterDataModel); void getTransfers(@NonNull String accountName, int page, int perPage);  }