@Test public void updateDelegateButtonState(){ EstimateGasResult estimateGasResult = new EstimateGasResult(); estimateGasResult.setBlockGasLimit("500000000000"); estimateGasResult.setFree("5983375239628300134343588424455034335218"); estimateGasResult.setGasLimit("1379820"); estimateGasResult.setGasPrice("500000000000"); estimateGasResult.setLock("0"); estimateGasResult.setMinDelegation("20000000000000000000"); estimateGasResult.setNonce("44"); presenter.setmEstimateGasResult(estimateGasResult); presenter.updateDelegateButtonState(); Mockito.verify(view).setDelegateButtonState(Mockito.anyBoolean()); }
@Override public void updateDelegateButtonState() { if (isViewAttached() && mEstimateGasResult != null) { String withdrawAmount = getView().getDelegateAmount(); boolean isAmountValid = !TextUtils.isEmpty(withdrawAmount) && NumberParserUtils.parseDouble(withdrawAmount) >= NumberParserUtils.parseDouble(NumberParserUtils.getPrettyBalance(AmountUtil.convertVonToLat(mEstimateGasResult.getMinDelegation()))); getView().setDelegateButtonState(isAmountValid); } }
DelegatePresenter extends BasePresenter<DelegateContract.View> implements DelegateContract.Presenter { @Override public void updateDelegateButtonState() { if (isViewAttached() && mEstimateGasResult != null) { String withdrawAmount = getView().getDelegateAmount(); boolean isAmountValid = !TextUtils.isEmpty(withdrawAmount) && NumberParserUtils.parseDouble(withdrawAmount) >= NumberParserUtils.parseDouble(NumberParserUtils.getPrettyBalance(AmountUtil.convertVonToLat(mEstimateGasResult.getMinDelegation()))); getView().setDelegateButtonState(isAmountValid); } } }
DelegatePresenter extends BasePresenter<DelegateContract.View> implements DelegateContract.Presenter { @Override public void updateDelegateButtonState() { if (isViewAttached() && mEstimateGasResult != null) { String withdrawAmount = getView().getDelegateAmount(); boolean isAmountValid = !TextUtils.isEmpty(withdrawAmount) && NumberParserUtils.parseDouble(withdrawAmount) >= NumberParserUtils.parseDouble(NumberParserUtils.getPrettyBalance(AmountUtil.convertVonToLat(mEstimateGasResult.getMinDelegation()))); getView().setDelegateButtonState(isAmountValid); } }  }
DelegatePresenter extends BasePresenter<DelegateContract.View> implements DelegateContract.Presenter { @Override public void updateDelegateButtonState() { if (isViewAttached() && mEstimateGasResult != null) { String withdrawAmount = getView().getDelegateAmount(); boolean isAmountValid = !TextUtils.isEmpty(withdrawAmount) && NumberParserUtils.parseDouble(withdrawAmount) >= NumberParserUtils.parseDouble(NumberParserUtils.getPrettyBalance(AmountUtil.convertVonToLat(mEstimateGasResult.getMinDelegation()))); getView().setDelegateButtonState(isAmountValid); } }  EstimateGasResult getmEstimateGasResult(); void setmEstimateGasResult(EstimateGasResult mEstimateGasResult); String getWalletAddress(); @Override void init(DelegateItemInfo delegateItemInfo); @Override void showSelectWalletDialogFragment(); @Override void showWalletInfo(); @Override void checkDelegateAmount(String delegateAmount); @Override void updateDelegateButtonState(); @SuppressLint("CheckResult") @Override void getGasProvider(StakingAmountType stakingAmountType); @Override void loadData(int walletTypeSearch, String keywords); @Override ArrayList<Wallet> getDataSource(); @Override void updateSelectedWalletnotifyData(Wallet selectedWallet); boolean checkKeywordsAddress(String input); void getAllPrice(StakingAmountType stakingAmountType, String amount, boolean keepBalance); String checkDelegateParam(EstimateGasResult estimateGasResult, StakingAmountType stakingAmountType); @SuppressLint("CheckResult") @Override void submitDelegate(StakingAmountType stakingAmountType); Wallet getWalletByAddress(String address); void getEstimateGas(String prefixAddress, String nodeId); }
DelegatePresenter extends BasePresenter<DelegateContract.View> implements DelegateContract.Presenter { @Override public void updateDelegateButtonState() { if (isViewAttached() && mEstimateGasResult != null) { String withdrawAmount = getView().getDelegateAmount(); boolean isAmountValid = !TextUtils.isEmpty(withdrawAmount) && NumberParserUtils.parseDouble(withdrawAmount) >= NumberParserUtils.parseDouble(NumberParserUtils.getPrettyBalance(AmountUtil.convertVonToLat(mEstimateGasResult.getMinDelegation()))); getView().setDelegateButtonState(isAmountValid); } }  EstimateGasResult getmEstimateGasResult(); void setmEstimateGasResult(EstimateGasResult mEstimateGasResult); String getWalletAddress(); @Override void init(DelegateItemInfo delegateItemInfo); @Override void showSelectWalletDialogFragment(); @Override void showWalletInfo(); @Override void checkDelegateAmount(String delegateAmount); @Override void updateDelegateButtonState(); @SuppressLint("CheckResult") @Override void getGasProvider(StakingAmountType stakingAmountType); @Override void loadData(int walletTypeSearch, String keywords); @Override ArrayList<Wallet> getDataSource(); @Override void updateSelectedWalletnotifyData(Wallet selectedWallet); boolean checkKeywordsAddress(String input); void getAllPrice(StakingAmountType stakingAmountType, String amount, boolean keepBalance); String checkDelegateParam(EstimateGasResult estimateGasResult, StakingAmountType stakingAmountType); @SuppressLint("CheckResult") @Override void submitDelegate(StakingAmountType stakingAmountType); Wallet getWalletByAddress(String address); void getEstimateGas(String prefixAddress, String nodeId);  }