Package com.consol.citrus.functions.core
Class MapValueFunction
- java.lang.Object
-
- com.consol.citrus.functions.core.MapValueFunction
-
- All Implemented Interfaces:
com.consol.citrus.common.InitializingPhase
,com.consol.citrus.functions.Function
public class MapValueFunction extends Object implements com.consol.citrus.functions.Function, com.consol.citrus.common.InitializingPhase
Function to map the function's argument to a corresponding value configured using a map.Example of the function definition and its usage:
<bean id="myCustomFunctionLibrary" class="com.consol.citrus.functions.FunctionLibrary"> <property name="name" value="myCustomFunctionLibrary" /> <property name="prefix" value="custom:" /> <property name="members"> <map> <entry key="mapHttpStatusCodeToMessage"> <bean class="com.consol.citrus.functions.core.MapValueFunction"> <property name="values"> <map> <entry key="200" value="OK" /> <entry key="401" value="Unauthorized" /> <entry key="500" value="Internal Server Error" /> </map> </property> </bean> </entry> </map> </property> </bean>
<variable name="httpStatusCodeMessage" value="custom:mapHttpStatusCodeToMessage('500')" />
- Author:
- Dimo Velev ([email protected])
-
-
Constructor Summary
Constructors Constructor Description MapValueFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
execute(List<String> params, com.consol.citrus.context.TestContext context)
Map<String,String>
getMap()
Gets the mappings for this function.void
initialize()
void
setMap(Map<String,String> map)
Sets the mappings for this function.
-
-
-
Method Detail
-
execute
public String execute(List<String> params, com.consol.citrus.context.TestContext context)
- Specified by:
execute
in interfacecom.consol.citrus.functions.Function
-
initialize
public void initialize()
- Specified by:
initialize
in interfacecom.consol.citrus.common.InitializingPhase
-
-