Search in sources :

Example 1 with SpecWithConditionFunction

use of org.eclipse.vorto.service.mapping.spec.SpecWithConditionFunction in project vorto by eclipse.

the class JsonMappingTest method testMapWithCustomFunctionCondition.

@Test
public void testMapWithCustomFunctionCondition() throws Exception {
    IDataMapper<DittoData> mapper = IDataMapper.newBuilder().withSpecification(new SpecWithConditionFunction()).buildDittoMapper();
    String json = "{\"data\" : \"aGFsbG8=\"}";
    DittoData mappedDittoOutput = mapper.map(DataInput.newInstance().fromJson(json), MappingContext.empty());
    assertEquals("hallo", mappedDittoOutput.getFeatures().get("button").getStatusProperties().get("sensor_value"));
}
Also used : SpecWithConditionFunction(org.eclipse.vorto.service.mapping.spec.SpecWithConditionFunction) DittoData(org.eclipse.vorto.service.mapping.ditto.DittoData) Test(org.junit.Test)

Aggregations

DittoData (org.eclipse.vorto.service.mapping.ditto.DittoData)1 SpecWithConditionFunction (org.eclipse.vorto.service.mapping.spec.SpecWithConditionFunction)1 Test (org.junit.Test)1