BankDealsPresenter extends BasePresenter<BankDeals.View> implements BankDeals.Actions, OnSelectedCallback<BankDeal> { @Override public void initialize() { trackView(); getBankDeals(); } BankDealsPresenter(final BankDealsRepository bankDealsRepository); @Override void initialize(); @Override void trackView(); @Override void getBankDeals(); @Override void recoverFromFailure(); @Override void onSelected(final BankDeal bankDeal);  }
@Test public void whenGetBankDealsWithSuccessThenShowThem() { final List<BankDeal> bankDealsListMLA = BankDealsUtils.getBankDealsListMLA(); when(bankDealsRepository.getBankDealsAsync()) .thenReturn(new StubSuccessMpCall<>(bankDealsListMLA)); presenter.initialize(); verify(view).showLoadingView(); verify(view).showBankDeals(eq(bankDealsListMLA), any(OnSelectedCallback.class)); verifyNoMoreInteractions(view); }
@Test public void whenGetBankDealsFailsThenShowError() { final ApiException apiException = mock(ApiException.class); when(bankDealsRepository.getBankDealsAsync()) .thenReturn(new StubFailMpCall<>(apiException)); presenter.initialize(); verify(view).showLoadingView(); verify(view).showApiExceptionError(any(MercadoPagoError.class)); verifyNoMoreInteractions(view); }