Source:
public void test_getActionIdByName () throws Exception { final ContentType contentGenericType = new ContentTypeDataGen().workflowId(SystemWorkflowConstants.SYSTEM_WORKFLOW_ID) .baseContentType(BaseContentType.CONTENT) .field(new FieldDataGen().name("title").velocityVarName("title").next()) .field(new FieldDataGen().name("body").velocityVarName("body").next()).nextPersisted(); final String unicodeText = "Numéro de téléphone"; final ContentletDataGen contentletDataGen = new ContentletDataGen(contentGenericType.id()); Contentlet contentlet = contentletDataGen.setProperty("title", "TestContent") .setProperty("body", unicodeText ).languageId(APILocator.getLanguageAPI().getDefaultLanguage().getId()).nextPersisted(); final WorkflowHelper workflowHelper = WorkflowHelper.getInstance(); final String saveActionId = workflowHelper.getActionIdByName("Save", contentlet, user); Assert.assertEquals("The action returned should be Save", SystemWorkflowConstants.WORKFLOW_SAVE_ACTION_ID, saveActionId); String archiveActionId = workflowHelper.getActionIdByName("Archive", contentlet, user); Assert.assertEquals("The action returned should be Archive", SystemWorkflowConstants.WORKFLOW_ARCHIVE_ACTION_ID, archiveActionId); final Contentlet contentletCheckin = APILocator.getWorkflowAPI().fireContentWorkflow(contentlet, new ContentletDependencies.Builder().workflowActionId(saveActionId).modUser(user).indexPolicy(IndexPolicy.FORCE).build()); archiveActionId = workflowHelper.getActionIdByName("Archive", contentletCheckin, user); Assert.assertEquals("The action returned should be Archive", SystemWorkflowConstants.WORKFLOW_ARCHIVE_ACTION_ID, archiveActionId); archiveActionId = workflowHelper.getActionIdByName("Non Existing Action", contentletCheckin, user); Assert.assertNull("The action returned should be Archive", archiveActionId); }

Target:
public void test_getActionIdByName () throws Exception { final ContentType contentGenericType = new ContentTypeDataGen().workflowId(SystemWorkflowConstants.SYSTEM_WORKFLOW_ID) .baseContentType(BaseContentType.CONTENT) .field(new FieldDataGen().name("title").velocityVarName("title").next()) .field(new FieldDataGen().name("body").velocityVarName("body").next()).nextPersisted(); final String unicodeText = "Numéro de téléphone"; final ContentletDataGen contentletDataGen = new ContentletDataGen(contentGenericType.id()); final Contentlet contentlet = contentletDataGen.setProperty("title", "TestContent") .setProperty("body", unicodeText ).languageId(APILocator.getLanguageAPI().getDefaultLanguage().getId()).nextPersisted(); final WorkflowHelper workflowHelper = WorkflowHelper.getInstance(); final String saveActionId = workflowHelper.getActionIdOnList("Save", contentlet, user); Assert.assertEquals("The action returned should be Save", SystemWorkflowConstants.WORKFLOW_SAVE_ACTION_ID, saveActionId); String archiveActionId = workflowHelper.getActionIdOnList("Archive", contentlet, user); Assert.assertEquals("The action returned should be Archive", SystemWorkflowConstants.WORKFLOW_ARCHIVE_ACTION_ID, archiveActionId); final Contentlet contentletCheckin = APILocator.getWorkflowAPI().fireContentWorkflow(contentlet, new ContentletDependencies.Builder().workflowActionId(saveActionId).modUser(user).indexPolicy(IndexPolicy.FORCE).build()); archiveActionId = workflowHelper.getActionIdOnList("Archive", contentletCheckin, user); Assert.assertEquals("The action returned should be Archive", SystemWorkflowConstants.WORKFLOW_ARCHIVE_ACTION_ID, archiveActionId); archiveActionId = workflowHelper.getActionIdOnList("Non Existing Action", contentletCheckin, user); Assert.assertNull("The action returned should be Archive", archiveActionId); }