AddRemoteRepositoryPresenter implements AddRemoteRepositoryView.ActionDelegate { @Override public void onValueChanged() { String name = view.getName(); String url = view.getUrl(); boolean isEnabled = !name.isEmpty() && !url.isEmpty(); view.setEnableOkButton(isEnabled); } @Inject  AddRemoteRepositoryPresenter(AddRemoteRepositoryView view, GitServiceClient service, AppContext appContext); void showDialog(@NotNull AsyncCallback<Void> callback); @Override void onOkClicked(); @Override void onCancelClicked(); @Override void onValueChanged();  }
@Test public void testOnValueChangedEnableButton() throws Exception { presenter.onValueChanged(); verify(view).setEnableOkButton(eq(ENABLE_BUTTON)); }
@Test public void testOnValueChangedDisableButton() throws Exception { when(view.getName()).thenReturn(EMPTY_TEXT); when(view.getUrl()).thenReturn(EMPTY_TEXT); presenter.onValueChanged(); verify(view).setEnableOkButton(eq(DISABLE_BUTTON)); }