use of org.kie.workbench.common.widgets.metadata.client.KieDocument in project kie-wb-common by kiegroup.
the class RegisteredDocumentsMenuBuilderTest method testActivateDocument_inactive.
@Test
public void testActivateDocument_inactive() {
final KieDocument document = makeKieDocument();
builder.registerDocument(document);
builder.activateDocument(mock(KieDocument.class));
verify(documentMenuItem, times(1)).setActive(eq(false));
}
use of org.kie.workbench.common.widgets.metadata.client.KieDocument in project kie-wb-common by kiegroup.
the class RegisteredDocumentsMenuBuilderTest method testOnRemoveDocument_WithCommand.
@Test
@SuppressWarnings("unchecked")
public void testOnRemoveDocument_WithCommand() {
final KieDocument document = makeKieDocument();
final ParameterizedCommand command = mock(ParameterizedCommand.class);
builder.setRemoveDocumentCommand(command);
builder.onRemoveDocument(document);
verify(command, times(1)).execute(eq(document));
}
use of org.kie.workbench.common.widgets.metadata.client.KieDocument in project kie-wb-common by kiegroup.
the class RegisteredDocumentsMenuBuilderTest method testActivateDocument_active.
@Test
public void testActivateDocument_active() {
final KieDocument document = makeKieDocument();
builder.registerDocument(document);
builder.activateDocument(document);
verify(documentMenuItem, times(1)).setActive(eq(true));
}
use of org.kie.workbench.common.widgets.metadata.client.KieDocument in project kie-wb-common by kiegroup.
the class RegisteredDocumentsMenuBuilderTest method testDereregisterDocument.
@Test
public void testDereregisterDocument() {
final KieDocument document = makeKieDocument();
builder.registerDocument(document);
builder.deregisterDocument(document);
verify(view, times(1)).deleteDocument(documentMenuItem);
verify(documentMenuItemProvider, times(1)).destroy(documentMenuItem);
}
use of org.kie.workbench.common.widgets.metadata.client.KieDocument in project kie-wb-common by kiegroup.
the class RegisteredDocumentsMenuBuilderTest method testRegisterDocument.
@Test
public void testRegisterDocument() {
final KieDocument document = makeKieDocument();
builder.registerDocument(document);
verify(documentMenuItem, times(1)).setName("filename");
verify(documentMenuItem, times(1)).setRemoveDocumentCommand(removeDocumentCommandCaptor.capture());
verify(documentMenuItem, times(1)).setActivateDocumentCommand(activateDocumentCommandCaptor.capture());
verify(view, times(1)).addDocument(eq(documentMenuItem));
final Command removeDocumentCommand = removeDocumentCommandCaptor.getValue();
assertNotNull(removeDocumentCommand);
removeDocumentCommand.execute();
verify(builder, times(1)).onRemoveDocument(document);
final Command activateDocumentCommand = activateDocumentCommandCaptor.getValue();
assertNotNull(activateDocumentCommand);
activateDocumentCommand.execute();
verify(builder, times(1)).onActivateDocument(document);
}
Aggregations