### Question:
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);  }### Answer:
@Test public void testGetMarketPrice_success() { CoinMarketCap coinMarketCap = new CoinMarketCap(); coinMarketCap.data = new CoinData(); when(eosManager.getMarketPrice(anyString())).thenReturn(Single.just(coinMarketCap)); presenter.getMarketPrice(Constants.EOS_COINMARKETCAP_ID); testScheduler.triggerActions(); verify(view, times(1)).setMarketPrice(any()); }
@Test public void returnNullCoinMarkertCap_success() { CoinMarketCap coinMarketCap = new CoinMarketCap(); when(eosManager.getMarketPrice(anyString())).thenReturn(Single.just(coinMarketCap)); presenter.getMarketPrice(Constants.EOS_COINMARKETCAP_ID); testScheduler.triggerActions(); verify(view, times(1)).noMarketPrice(); }
@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(); }