public class MapValueFunction extends Object implements Function, org.springframework.beans.factory.InitializingBean
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>
and the corresponding usage in a test which maps the HTTP status code 500 to its message 'Internal Server Error':
<variable name="httpStatusCodeMessage" value="custom:mapHttpStatusCodeToMessage('500')" />
Constructor and Description |
---|
MapValueFunction() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Check that map is set correctly after initialization
|
String |
execute(List<String> params,
TestContext context)
Method called on execution.
|
Map<String,String> |
getMap()
Gets the mappings for this function.
|
void |
setMap(Map<String,String> map)
Sets the mappings for this function.
|
public String execute(List<String> params, TestContext context)
Function
execute
in interface Function
params
- list of function arguments.Function.execute(java.util.List, com.consol.citrus.context.TestContext)
public void afterPropertiesSet()
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Copyright © 2008–2017 ConSol Software GmbH. All rights reserved.