Search in sources :

Example 6 with DiscussionRecord

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!");
}
Also used : DiscussionWidgetView(org.kie.workbench.common.widgets.client.discussion.DiscussionWidgetView) Path(org.uberfire.backend.vfs.Path) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) DiscussionRecord(org.guvnor.common.services.shared.metadata.model.DiscussionRecord) DiscussionWidgetPresenter(org.kie.workbench.common.widgets.client.discussion.DiscussionWidgetPresenter) Test(org.junit.Test)

Aggregations

DiscussionRecord (org.guvnor.common.services.shared.metadata.model.DiscussionRecord)6 Test (org.junit.Test)3 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)2 DiscussionWidgetPresenter (org.kie.workbench.common.widgets.client.discussion.DiscussionWidgetPresenter)2 Date (java.util.Date)1 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)1 CommentAddedEvent (org.kie.workbench.common.services.shared.discussion.CommentAddedEvent)1 DiscussionWidgetView (org.kie.workbench.common.widgets.client.discussion.DiscussionWidgetView)1 Path (org.uberfire.backend.vfs.Path)1