use of org.activiti.engine.delegate.Expression in project herd by FINRAOS.
the class ActivitiHelperTest method testGetExpressionVariableAsIntegerRequiredBlankValue.
@Test
public void testGetExpressionVariableAsIntegerRequiredBlankValue() {
// Mock dependencies.
Expression expression = mock(Expression.class);
DelegateExecution execution = mock(DelegateExecution.class);
when(expression.getValue(execution)).thenReturn(BLANK_TEXT);
// Try to call the method under test.
try {
activitiHelper.getExpressionVariableAsInteger(expression, execution, VARIABLE_NAME, VARIABLE_REQUIRED);
fail();
} catch (IllegalArgumentException e) {
assertEquals(String.format("\"%s\" must be specified.", VARIABLE_NAME), e.getMessage());
}
}
use of org.activiti.engine.delegate.Expression in project herd by FINRAOS.
the class ActivitiHelperTest method testGetRequiredExpressionVariableAsStringBlankValue.
@Test
public void testGetRequiredExpressionVariableAsStringBlankValue() {
// Mock dependencies.
Expression expression = mock(Expression.class);
DelegateExecution execution = mock(DelegateExecution.class);
when(expression.getValue(execution)).thenReturn(BLANK_TEXT);
// Try to call the method under test.
try {
activitiHelper.getRequiredExpressionVariableAsString(expression, execution, VARIABLE_NAME);
fail();
} catch (IllegalArgumentException e) {
assertEquals(String.format("\"%s\" must be specified.", VARIABLE_NAME), e.getMessage());
}
}
use of org.activiti.engine.delegate.Expression in project herd by FINRAOS.
the class ActivitiHelperTest method testGetExpressionVariableAsBooleanRequiredBlankValue.
@Test
public void testGetExpressionVariableAsBooleanRequiredBlankValue() {
// Mock dependencies.
Expression expression = mock(Expression.class);
DelegateExecution execution = mock(DelegateExecution.class);
when(expression.getValue(execution)).thenReturn(BLANK_TEXT);
// Try to call the method under test.
try {
activitiHelper.getExpressionVariableAsBoolean(expression, execution, VARIABLE_NAME, VARIABLE_REQUIRED, NO_BOOLEAN_DEFAULT_VALUE);
fail();
} catch (IllegalArgumentException e) {
assertEquals(String.format("\"%s\" must be specified.", VARIABLE_NAME), e.getMessage());
}
}
use of org.activiti.engine.delegate.Expression in project herd by FINRAOS.
the class ActivitiHelperTest method testGetExpressionVariableAsBooleanBlankValue.
@Test
public void testGetExpressionVariableAsBooleanBlankValue() {
// Mock dependencies.
Expression expression = mock(Expression.class);
DelegateExecution execution = mock(DelegateExecution.class);
when(expression.getValue(execution)).thenReturn(BLANK_TEXT);
// Call the method under test.
Boolean result = activitiHelper.getExpressionVariableAsBoolean(expression, execution, VARIABLE_NAME, NO_VARIABLE_REQUIRED, BOOLEAN_DEFAULT_VALUE);
// Validate the result.
assertEquals(BOOLEAN_DEFAULT_VALUE, result);
}
use of org.activiti.engine.delegate.Expression in project herd by FINRAOS.
the class ActivitiHelperTest method testGetExpressionVariableAsInteger.
@Test
public void testGetExpressionVariableAsInteger() {
// Mock dependencies.
Expression expression = mock(Expression.class);
DelegateExecution execution = mock(DelegateExecution.class);
when(expression.getValue(execution)).thenReturn(INTEGER_VALUE.toString());
// Call the method under test.
Integer result = activitiHelper.getExpressionVariableAsInteger(expression, execution, VARIABLE_NAME, NO_VARIABLE_REQUIRED);
// Validate the result.
assertEquals(INTEGER_VALUE, result);
}
Aggregations