use of org.guvnor.common.services.shared.metadata.model.DiscussionRecord in project kie-wb-common by kiegroup.
the class DiscussionWidgetPresenterTest method testAddComment.
@Test
public void testAddComment() throws Exception {
ArgumentCaptor<DiscussionRecord> discussionRecordArgumentCaptor = ArgumentCaptor.forClass(DiscussionRecord.class);
when(identity.getIdentifier()).thenReturn("Toni");
DiscussionWidgetPresenter presenterImpl = new DiscussionWidgetPresenter(view, identity, appConfigService);
DiscussionWidgetView.Presenter presenter = presenterImpl;
Metadata metadata = spy(new Metadata());
Path path = mock(Path.class);
when(metadata.getPath()).thenReturn(path);
presenterImpl.setContent(metadata);
presenter.onAddComment("Hello World!");
verify(view).addRow(discussionRecordArgumentCaptor.capture());
DiscussionRecord line = discussionRecordArgumentCaptor.getValue();
assertNotNull(line);
assertEquals(line.getTimestamp(), new Long(1234));
assertEquals(line.getAuthor(), "Toni");
assertEquals(line.getNote(), "Hello World!");
}
Aggregations