verify(mockNewCommentText).setText("");
}
@Test
public void show() {
GlossaryResultItem item = new GlossaryResultItem("", "", 0, 0);
when(
mockUserWorkspaceContext.getWorkspaceRestrictions()
.isHasGlossaryUpdateAccess()).thenReturn(true);
glossaryDetailsPresenter.show(item);
verify(mockDispatcher).execute(getGlossaryDetailsCaptor.capture(),
getGlossarycallbackCaptor.capture());
assertThat(getGlossaryDetailsCaptor.getValue().getSourceIdList(),
Matchers.equalTo(item.getSourceIdList()));
AsyncCallback<GetGlossaryDetailsResult> callback =
getGlossarycallbackCaptor.getValue();
// testing success callback
GlossaryDetails glossaryDetails = mock(GlossaryDetails.class);
when(glossaryDetails.getSource()).thenReturn("source text");
when(glossaryDetails.getTarget()).thenReturn("target text");
when(glossaryDetails.getSrcLocale()).thenReturn(new LocaleId("en-US"));
when(glossaryDetails.getTargetLocale()).thenReturn(new LocaleId("zh"));
when(glossaryDetails.getTarget()).thenReturn("source text");
when(display.getSrcRef()).thenReturn(srcRef);
when(display.getTargetText()).thenReturn(targetText);
when(display.getSourceLabel()).thenReturn(sourceLabel);
when(display.getTargetLabel()).thenReturn(targetLabel);
when(messages.entriesLabel(1)).thenReturn("1");
callback.onSuccess(new GetGlossaryDetailsResult(Lists
.newArrayList(glossaryDetails)));
verify(display).setSourceText(item.getSource());
verify(targetText).setText(item.getSource());
verify(display).clearEntries();
verify(display).setSourceText(anyString());
verify(targetLabel).setText(anyString());
verify(display).addEntry("1");
verify(display).show();