@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);
}