use of org.eclipse.vorto.service.mapping.spec.SpecWithArrayPayload in project vorto by eclipse.
the class JsonMappingTest method testDittoMappingUsingListInput.
@Test
public void testDittoMappingUsingListInput() throws Exception {
IDataMapper<DittoData> mapper = IDataMapper.newBuilder().withSpecification(new SpecWithArrayPayload()).buildDittoMapper();
String json = "[{\"clickType\" : \"DOUBLE\" }, {\"clickType\" : \"SINGLE\" }]";
DittoData mappedDittoOutput = mapper.map(DataInput.newInstance().fromJson(json), MappingContext.empty());
Feature buttonFeature = mappedDittoOutput.getFeatures().get("button");
assertEquals("DOUBLE", buttonFeature.getStatusProperties().get("sensor_value"));
System.out.println(mappedDittoOutput.toJson());
}
Aggregations