use of org.eclipse.vorto.service.mapping.spec.SpecWithByteArrayConverter in project vorto by eclipse.
the class BinaryMappingTest method testMappingWithBinary.
@Test
public void testMappingWithBinary() throws Exception {
IDataMapper<DittoData> mapper = IDataMapper.newBuilder().withSpecification(new SpecWithByteArrayConverter()).buildDittoMapper();
String json = "{\"data\" : [0, 0, 0, -48, 7, 0]}";
DittoData mappedDittoOutput = mapper.map(DataInputFactory.getInstance().fromJson(json), MappingContext.empty());
Feature buttonFeature = mappedDittoOutput.getFeatures().get("button");
assertEquals(20.00, buttonFeature.getStatusProperties().get("sensor_value"));
System.out.println(mappedDittoOutput.toJson());
}
Aggregations