@Test public void onContinue_firstNameTooShort() { presenter.onContinue("A", "Valid Last Name"); verify(view, times(1)).showFirstNameError(); verify(view, never()).showLastNameError(); }
@Override void onContinue(final String firstName, final String lastName) { onView(new ViewAction<MainContract.ViewOperations>() { @Override public void onAction(MainContract.ViewOperations view) { boolean isValid = true; if (Utils.isStringEmpty(firstName) || firstName.length() < 2) { view.showFirstNameError(); isValid = false; } if (Utils.isStringEmpty(lastName) || lastName.length() < 2) { view.showLastNameError(); isValid = false; } if (isValid) { saveDetails(firstName, lastName); } } }); }
MainPresenter extends MainContract.PresenterViewOperations { @Override void onContinue(final String firstName, final String lastName) { onView(new ViewAction<MainContract.ViewOperations>() { @Override public void onAction(MainContract.ViewOperations view) { boolean isValid = true; if (Utils.isStringEmpty(firstName) || firstName.length() < 2) { view.showFirstNameError(); isValid = false; } if (Utils.isStringEmpty(lastName) || lastName.length() < 2) { view.showLastNameError(); isValid = false; } if (isValid) { saveDetails(firstName, lastName); } } }); } }
MainPresenter extends MainContract.PresenterViewOperations { @Override void onContinue(final String firstName, final String lastName) { onView(new ViewAction<MainContract.ViewOperations>() { @Override public void onAction(MainContract.ViewOperations view) { boolean isValid = true; if (Utils.isStringEmpty(firstName) || firstName.length() < 2) { view.showFirstNameError(); isValid = false; } if (Utils.isStringEmpty(lastName) || lastName.length() < 2) { view.showLastNameError(); isValid = false; } if (isValid) { saveDetails(firstName, lastName); } } }); }  }
MainPresenter extends MainContract.PresenterViewOperations { @Override void onContinue(final String firstName, final String lastName) { onView(new ViewAction<MainContract.ViewOperations>() { @Override public void onAction(MainContract.ViewOperations view) { boolean isValid = true; if (Utils.isStringEmpty(firstName) || firstName.length() < 2) { view.showFirstNameError(); isValid = false; } if (Utils.isStringEmpty(lastName) || lastName.length() < 2) { view.showLastNameError(); isValid = false; } if (isValid) { saveDetails(firstName, lastName); } } }); }   }
MainPresenter extends MainContract.PresenterViewOperations { @Override void onContinue(final String firstName, final String lastName) { onView(new ViewAction<MainContract.ViewOperations>() { @Override public void onAction(MainContract.ViewOperations view) { boolean isValid = true; if (Utils.isStringEmpty(firstName) || firstName.length() < 2) { view.showFirstNameError(); isValid = false; } if (Utils.isStringEmpty(lastName) || lastName.length() < 2) { view.showLastNameError(); isValid = false; } if (isValid) { saveDetails(firstName, lastName); } } }); }    }