### Question:
IssuePresenter implements IsWidget { public void show(final Issue issue) { final String title = ExplanationProvider.toTitle(issue); view.setIssueTitle(title); view.setExplanation(ExplanationProvider.toHTML(issue)); view.setLines(makeRowNumbers(issue)); } @Inject  IssuePresenter(final IssuePresenterView view); @Override Widget asWidget(); void show(final Issue issue); void clear();  }### Answer:
@Test public void testShow() throws Exception { Issue issue = new Issue(Severity.WARNING, CheckType.REDUNDANT_ROWS, new HashSet<>(Arrays.asList(1, 2, 3)) ); screen.show(issue); verify(view).setIssueTitle("RedundantRows"); ArgumentCaptor<SafeHtml> safeHtmlArgumentCaptor = ArgumentCaptor.forClass(SafeHtml.class); verify(view).setExplanation(safeHtmlArgumentCaptor.capture()); assertEquals("<p>MissingRangeP1(1)</p>", safeHtmlArgumentCaptor.getValue() .asString()); verify(view).setLines("1, 2, 3"); }
@Test public void testIllegalVerifierState() { final Issue issue = new IllegalVerifierStateIssue(); screen.show(issue); verify(view).setIssueTitle("VerifierFailedTitle"); ArgumentCaptor<SafeHtml> safeHtmlArgumentCaptor = ArgumentCaptor.forClass(SafeHtml.class); verify(view).setExplanation(safeHtmlArgumentCaptor.capture()); assertEquals("<p>VerifierFailed</p>", safeHtmlArgumentCaptor.getValue().asString()); verify(view).setLines(""); }
@Test public void testShowEmptyIssue() throws Exception { screen.show(Issue.EMPTY); verify(view).setIssueTitle("---"); ArgumentCaptor<SafeHtml> safeHtmlArgumentCaptor = ArgumentCaptor.forClass(SafeHtml.class); verify(view).setExplanation(safeHtmlArgumentCaptor.capture()); assertEquals("---", safeHtmlArgumentCaptor.getValue() .asString()); verify(view).setLines(""); }