use of org.mule.runtime.core.privileged.util.AttributeEvaluator in project mule by mulesoft.
the class MELAttributeEvaluatorTestCase method parse.
@Test
public void parse() {
AttributeEvaluator attributeEvaluator = new AttributeEvaluator("1#[mel:2]3#[mel:4]5");
attributeEvaluator.initialize(mockExpressionManager);
attributeEvaluator.resolveValue(event);
verify(mockExpressionManager).parse(anyString(), any(CoreEvent.class), any());
verify(mockExpressionManager, never()).evaluate(anyString(), any(CoreEvent.class));
verify(mockExpressionManager, never()).evaluate(anyString(), any(DataType.class), any(), any(CoreEvent.class));
}
use of org.mule.runtime.core.privileged.util.AttributeEvaluator in project mule by mulesoft.
the class MELAttributeEvaluatorTestCase method parenthesesInExpression.
@Test
public void parenthesesInExpression() {
when(mockExpressionManager.evaluate(anyString(), any(CoreEvent.class))).thenReturn(new TypedValue(null, OBJECT));
AttributeEvaluator attributeEvaluator = new AttributeEvaluator("#[mel:(1)]");
attributeEvaluator.initialize(mockExpressionManager);
attributeEvaluator.resolveValue(event);
verify(mockExpressionManager, never()).parse(anyString(), any(CoreEvent.class), any());
verify(mockExpressionManager).evaluate(anyString(), any(CoreEvent.class));
verify(mockExpressionManager, never()).evaluate(anyString(), any(DataType.class), any(), any(CoreEvent.class));
}
use of org.mule.runtime.core.privileged.util.AttributeEvaluator in project mule by mulesoft.
the class MELAttributeEvaluatorTestCase method expressionValueNoEvaluator.
@Test
public void expressionValueNoEvaluator() {
String attributeValue = "#[mel:express]";
when(mockExpressionManager.evaluate(eq(attributeValue), any(CoreEvent.class))).thenReturn(new TypedValue(null, OBJECT));
when(mockExpressionManager.isExpression(attributeValue)).thenReturn(true);
AttributeEvaluator attributeEvaluator = new AttributeEvaluator(attributeValue);
attributeEvaluator.initialize(mockExpressionManager);
attributeEvaluator.resolveValue(event);
verify(mockExpressionManager, never()).parse(anyString(), any(CoreEvent.class), any());
verify(mockExpressionManager).evaluate(anyString(), any(CoreEvent.class));
verify(mockExpressionManager, never()).evaluate(anyString(), any(DataType.class), any(), any(CoreEvent.class));
}
use of org.mule.runtime.core.privileged.util.AttributeEvaluator in project mule by mulesoft.
the class MELAttributeEvaluatorTestCase method expressionValue.
@Test
public void expressionValue() {
String attributeValue = "#[mel:eval:express]";
when(mockExpressionManager.evaluate(eq(attributeValue), any(CoreEvent.class))).thenReturn(new TypedValue(null, OBJECT));
when(mockExpressionManager.isExpression(attributeValue)).thenReturn(true);
AttributeEvaluator attributeEvaluator = new AttributeEvaluator(attributeValue);
attributeEvaluator.initialize(mockExpressionManager);
attributeEvaluator.resolveValue(event);
verify(mockExpressionManager, never()).parse(anyString(), any(CoreEvent.class), any());
verify(mockExpressionManager).evaluate(anyString(), any(CoreEvent.class));
verify(mockExpressionManager, never()).evaluate(anyString(), any(DataType.class), any(), any(CoreEvent.class));
}
use of org.mule.runtime.core.privileged.util.AttributeEvaluator in project mule by mulesoft.
the class MELAttributeEvaluatorTestCase method testParseStartsWithExpression.
@Test
public void testParseStartsWithExpression() {
AttributeEvaluator attributeEvaluator = new AttributeEvaluator("#[mel:1]234#[mel:5]");
attributeEvaluator.initialize(mockExpressionManager);
attributeEvaluator.resolveValue(event);
verify(mockExpressionManager).parse(anyString(), any(CoreEvent.class), any());
verify(mockExpressionManager, never()).evaluate(anyString(), any(CoreEvent.class));
verify(mockExpressionManager, never()).evaluate(anyString(), any(DataType.class), any(), any(CoreEvent.class));
}
Aggregations