@Test public void testCaseTaskDescription() { // given String description = "This is a caseTask"; caseTask.setDescription(description); // when CmmnActivity activity = handler.handleElement(planItem, context); // then assertEquals(description, (String) activity.getProperty(PROPERTY_ACTIVITY_DESCRIPTION)); }
@Test public void testCaseTaskActivityName() { // given: // the caseTask has a name "A CaseTask" String name = "A CaseTask"; caseTask.setName(name); // when CmmnActivity activity = handler.handleElement(planItem, context); // then assertEquals(name, activity.getName()); }
@Test public void testIsBlockingEqualsFalseProperty() { // given: // a caseTask with isBlocking = false caseTask.setIsBlocking(false); // when CmmnActivity activity = handler.handleElement(planItem, context); // then Boolean isBlocking = (Boolean) activity.getProperty(PROPERTY_IS_BLOCKING); assertFalse(isBlocking); }
@Test public void testBinding() { // given: CallableElementBinding caseBinding = CallableElementBinding.LATEST; caseTask.setCamundaCaseBinding(caseBinding.getValue()); // when CmmnActivity activity = handler.handleElement(planItem, context); // then CaseTaskActivityBehavior behavior = (CaseTaskActivityBehavior) activity.getActivityBehavior(); CallableElement callableElement = behavior.getCallableElement(); CallableElementBinding binding = callableElement.getBinding(); assertNotNull(binding); assertEquals(caseBinding, binding); }
@Test public void testPlanItemActivityName() { // given: // the caseTask has a name "A CaseTask" String name = "A CaseTask"; caseTask.setName(name); // the planItem has an own name "My LocalName" String planItemName = "My LocalName"; planItem.setName(planItemName); // when CmmnActivity activity = handler.handleElement(planItem, context); // then assertNotEquals(name, activity.getName()); assertEquals(planItemName, activity.getName()); }
@Test public void testVersionConstant() { // given: String caseVersion = "2"; caseTask.setCamundaCaseVersion(caseVersion); // when CmmnActivity activity = handler.handleElement(planItem, context); // then CaseTaskActivityBehavior behavior = (CaseTaskActivityBehavior) activity.getActivityBehavior(); CallableElement callableElement = behavior.getCallableElement(); ParameterValueProvider caseVersionValueProvider = callableElement.getVersionValueProvider(); assertNotNull(caseVersionValueProvider); assertTrue(caseVersionValueProvider instanceof ConstantValueProvider); assertEquals(caseVersion, caseVersionValueProvider.getValue(null)); }
@Test public void testCaseRefExpression() { // given: String caseRef = "${aCaseToCall}"; caseTask.setCase(caseRef); // when CmmnActivity activity = handler.handleElement(planItem, context); // then CaseTaskActivityBehavior behavior = (CaseTaskActivityBehavior) activity.getActivityBehavior(); CallableElement callableElement = behavior.getCallableElement(); ParameterValueProvider caseRefValueProvider = callableElement.getDefinitionKeyValueProvider(); assertNotNull(caseRefValueProvider); assertTrue(caseRefValueProvider instanceof ElValueProvider); ElValueProvider valueProvider = (ElValueProvider) caseRefValueProvider; assertEquals(caseRef, valueProvider.getExpression().getExpressionText()); }