use of org.activityinfo.shared.command.result.VoidResult in project activityinfo by bedatadriven.
the class DesignTest method testDeleteEnabled.
@Test
public void testDeleteEnabled() {
// Dummy Data
SchemaDTO schema = DTOs.pear();
// Collaborator
DispatcherStub service = new DispatcherStub();
service.setResult(GetSchema.class, schema);
service.setResult(Delete.class, new VoidResult());
// Collaborator
DesignPresenter.View view = createNiceMock(DesignPresenter.View.class);
view.setActionEnabled(UIActions.DELETE, false);
replay(view);
// Collaborator
UIConstants constants = createNiceMock(UIConstants.class);
replay(constants);
DesignPresenter designer = new DesignPresenter(new MockEventBus(), service, new StateManagerStub(), view, constants);
designer.go(schema.getDatabaseById(1));
// Verify that the delete command is initially disabled
verify(view);
// Verify that the delete command is enabled when an activity is
// selected
resetToDefault(view);
view.setActionEnabled(UIActions.DELETE, true);
replay(view);
designer.onSelectionChanged(schema.getActivityById(91));
verify(view);
// Verify that the delete command is disabled when a folder is selected
reset(view);
view.setActionEnabled(UIActions.DELETE, false);
replay(view);
designer.onSelectionChanged(new IndicatorFolder(null));
verify(view);
}
Aggregations