ActionWorkItemSetFieldPlugin extends BaseDecisionTableColumnPlugin implements HasFieldPage,
                                                                                           HasPatternPage,
                                                                                           HasWorkItemPage,
                                                                                           HasAdditionalInfoPage { @Override public void setWorkItem(final String workItemKey) { setWorkItem("", "", ""); getWorkItems() .forEach((key, workItemParameter) -> { if (trim(key).equals(trim(workItemKey))) { final PortableWorkDefinition workDefinition = workItemParameter.getWorkDefinition(); final PortableParameterDefinition parameterDefinition = workItemParameter.getWorkParameterDefinition(); selectedWorkItemKey = trim(key); setWorkItem(workDefinition.getName(), parameterDefinition.getName(), parameterDefinition.getClassName()); fireChangeEvent(workItemPage); } }); } @Inject  ActionWorkItemSetFieldPlugin(final PatternPage patternPage,
                                        final FieldPage fieldPage,
                                        final AdditionalInfoPage additionalInfoPage,
                                        final WorkItemPage workItemPage,
                                        final Event<WizardPageStatusChangeEvent> changeEvent,
                                        final TranslationService translationService); @Override void init(final NewGuidedDecisionTableColumnWizard wizard); @Override String getWorkItem(); @Override void setWorkItem(final String workItemKey); @Override ActionCol52 editingCol(); @Override Boolean isWorkItemSet(); @Override PortableWorkDefinition getWorkItemDefinition(); @Override void forEachWorkItem(BiConsumer<String, String> biConsumer); @Override void setWorkItemPageAsCompleted(); @Override String getHeader(); @Override void setHeader(final String header); @Override Set<String> getAlreadyUsedColumnHeaders(); @Override boolean isHideColumn(); @Override void setHideColumn(boolean hideColumn); @Override void setInsertLogical(final Boolean isInsertLogical); @Override void setUpdate(final Boolean isUpdate); @Override String getTitle(); @Override List<WizardPage> getPages(); @Override Boolean generateColumn(); @Override PatternWrapper patternWrapper(); @Override void setEditingPattern(final PatternWrapper patternWrapper); @Override String getEntryPointName(); @Override void setEntryPointName(final String entryPointName); @Override String getPatternPageDescription(); @Override Set<PatternWrapper> getPatterns(); @Override int constraintValue(); @Override FieldAccessorsAndMutators getAccessor(); @Override boolean filterEnumFields(); @Override boolean isFieldBindingValid(); @Override String getBinding(); @Override void setBinding(final String binding); @Override boolean isBindable(); @Override String getFactField(); @Override void setFactField(final String selectedValue); @Override boolean showUpdateEngineWithChanges(); @Override boolean showLogicallyInsert(); @Override boolean isLogicallyInsert(); @Override boolean isUpdateEngine(); @Override Type getType();  }
@Test public void testSetWorkItem() throws Exception { final String workItemKey = "workItem"; final PortableWorkDefinition workDefinition = mock(PortableWorkDefinition.class); final PortableParameterDefinition parameterDefinition = mock(PortableParameterDefinition.class); final ActionWorkItemSetFieldPlugin.WorkItemParameter parameter = mock(ActionWorkItemSetFieldPlugin.WorkItemParameter.class); final HashMap<String, ActionWorkItemSetFieldPlugin.WorkItemParameter> workItems = new HashMap<String, ActionWorkItemSetFieldPlugin.WorkItemParameter>() {{ put(workItemKey, parameter); }}; final List<ActionInsertFactCol52> actions = new ArrayList<ActionInsertFactCol52>() {{ add(mock(ActionInsertFactCol52.class)); }}; doReturn(model).when(presenter).getModel(); doReturn(actions).when(model).getActionCols(); doReturn("workName").when(workDefinition).getName(); doReturn("parameterName").when(parameterDefinition).getName(); doReturn("parameterClassName").when(parameterDefinition).getClassName(); doReturn(workItems).when(plugin).getWorkItems(); doReturn(workDefinition).when(parameter).getWorkDefinition(); doReturn(parameterDefinition).when(parameter).getWorkParameterDefinition(); plugin.setWorkItem(workItemKey); assertEquals(workItemKey, plugin.getWorkItem()); verify(editingWrapper).setWorkItemName("workName"); verify(editingWrapper).setWorkItemResultParameterName("parameterName"); verify(editingWrapper).setParameterClassName("parameterClassName"); verify(plugin).fireChangeEvent(workItemPage); }