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