### Question:
ExternalLinkPresenter implements IsWidget { public void setLink(final String text) { if (text == null || text.trim() .isEmpty()) { view.setText(""); showEdit(); } else { showLink(); view.setText(text); view.setLink(text); } } @Inject  ExternalLinkPresenter(final ExternalLinkView view); void onEdit(); @Override Widget asWidget(); void setLink(final String text); void addChangeCallback(final Callback<String> callback); void onTextChange(final String text); void onTextChangeDone();  }### Answer:
@Test public void setLink() throws Exception { presenter.setLink("http: verify(view).setLinkModeVisibility(true); verify(view).setEditModeVisibility(false); verify(view).setLink("http: verify(view).setText("http: }
@Test public void setEmptyShowsEditModeAutomatically() throws Exception { presenter.setLink(""); verify(view).setLinkModeVisibility(false); verify(view).setEditModeVisibility(true); verify(view).setText(""); }
@Test public void setNullShowsEditModeAutomaticallyWithEmptyText() throws Exception { presenter.setLink(null); verify(view).setLinkModeVisibility(false); verify(view).setEditModeVisibility(true); verify(view).setText(""); }