@Test public void testShowNoConnectionMessage() throws Exception { final String noConnectionMessage = "Unable to resolve host \"www.pola-app.pl\": No address associated with hostname"; presenter.onFailure(null, new Throwable(noConnectionMessage)); verify(viewBinder).showNoConnectionMessage(); }
@Override public void onFailure(Call<SearchResult> call, Throwable t) { if ("Unable to resolve host \"www.pola-app.pl\": No address associated with hostname".equals(t.getLocalizedMessage())) { viewBinder.showNoConnectionMessage(); } else { viewBinder.showErrorMessage(t.getLocalizedMessage()); } handlerScanner.removeCallbacks(runnableResumeScan); productList.removeProductPlaceholder(); viewBinder.resumeScanning(); }
MainPresenter implements Callback<SearchResult>, BarcodeListener { @Override public void onFailure(Call<SearchResult> call, Throwable t) { if ("Unable to resolve host \"www.pola-app.pl\": No address associated with hostname".equals(t.getLocalizedMessage())) { viewBinder.showNoConnectionMessage(); } else { viewBinder.showErrorMessage(t.getLocalizedMessage()); } handlerScanner.removeCallbacks(runnableResumeScan); productList.removeProductPlaceholder(); viewBinder.resumeScanning(); } }
MainPresenter implements Callback<SearchResult>, BarcodeListener { @Override public void onFailure(Call<SearchResult> call, Throwable t) { if ("Unable to resolve host \"www.pola-app.pl\": No address associated with hostname".equals(t.getLocalizedMessage())) { viewBinder.showNoConnectionMessage(); } else { viewBinder.showErrorMessage(t.getLocalizedMessage()); } handlerScanner.removeCallbacks(runnableResumeScan); productList.removeProductPlaceholder(); viewBinder.resumeScanning(); } MainPresenter(@NonNull MainViewBinder viewBinder,
                  @NonNull ProductList productList,
                  @NonNull Api api,
                  @NonNull EventLogger logger,
                  @NonNull SessionId sessionId,
                  @NonNull Bus eventBus); }
MainPresenter implements Callback<SearchResult>, BarcodeListener { @Override public void onFailure(Call<SearchResult> call, Throwable t) { if ("Unable to resolve host \"www.pola-app.pl\": No address associated with hostname".equals(t.getLocalizedMessage())) { viewBinder.showNoConnectionMessage(); } else { viewBinder.showErrorMessage(t.getLocalizedMessage()); } handlerScanner.removeCallbacks(runnableResumeScan); productList.removeProductPlaceholder(); viewBinder.resumeScanning(); } MainPresenter(@NonNull MainViewBinder viewBinder,
                  @NonNull ProductList productList,
                  @NonNull Api api,
                  @NonNull EventLogger logger,
                  @NonNull SessionId sessionId,
                  @NonNull Bus eventBus); static MainPresenter create(Context applicationContext, @NonNull final MainViewBinder viewBinder,
                                       @NonNull final ProductList productList,
                                       @NonNull final ProductsAdapter productsAdapter,
                                       @NonNull SessionId sessionId,
                                       @NonNull final Bus eventBus); @Override void onBarcode(String barcode, boolean fromCamera); @Override void onResponse(Call<SearchResult> call, Response<SearchResult> response); @Override void onFailure(Call<SearchResult> call, Throwable t); @Subscribe @SuppressWarnings("WeakerAccess") void productDetailsFragmentDismissed(@SuppressWarnings("UnusedParameters") ProductDetailsFragmentDismissedEvent event); @Subscribe @SuppressWarnings("WeakerAccess") void reportButtonClicked(ReportButtonClickedEvent event); void setCurrentSearchResult(SearchResult currentSearchResult); void onBackStackChange(boolean isNotBackStackEmpty); void onSupportPolaButtonClick(); void onSupportPolaFinished(); }
MainPresenter implements Callback<SearchResult>, BarcodeListener { @Override public void onFailure(Call<SearchResult> call, Throwable t) { if ("Unable to resolve host \"www.pola-app.pl\": No address associated with hostname".equals(t.getLocalizedMessage())) { viewBinder.showNoConnectionMessage(); } else { viewBinder.showErrorMessage(t.getLocalizedMessage()); } handlerScanner.removeCallbacks(runnableResumeScan); productList.removeProductPlaceholder(); viewBinder.resumeScanning(); } MainPresenter(@NonNull MainViewBinder viewBinder,
                  @NonNull ProductList productList,
                  @NonNull Api api,
                  @NonNull EventLogger logger,
                  @NonNull SessionId sessionId,
                  @NonNull Bus eventBus); static MainPresenter create(Context applicationContext, @NonNull final MainViewBinder viewBinder,
                                       @NonNull final ProductList productList,
                                       @NonNull final ProductsAdapter productsAdapter,
                                       @NonNull SessionId sessionId,
                                       @NonNull final Bus eventBus); @Override void onBarcode(String barcode, boolean fromCamera); @Override void onResponse(Call<SearchResult> call, Response<SearchResult> response); @Override void onFailure(Call<SearchResult> call, Throwable t); @Subscribe @SuppressWarnings("WeakerAccess") void productDetailsFragmentDismissed(@SuppressWarnings("UnusedParameters") ProductDetailsFragmentDismissedEvent event); @Subscribe @SuppressWarnings("WeakerAccess") void reportButtonClicked(ReportButtonClickedEvent event); void setCurrentSearchResult(SearchResult currentSearchResult); void onBackStackChange(boolean isNotBackStackEmpty); void onSupportPolaButtonClick(); void onSupportPolaFinished();  }