use of org.eclipse.vorto.service.mapping.spec.SpecWithNestedEnum in project vorto by eclipse.
the class DataMapperTest method testMappingWithEnum.
@Test
public void testMappingWithEnum() throws Exception {
IDataMapper mapper = IDataMapper.newBuilder().withSpecification(new SpecWithNestedEnum()).build();
final String sampleDeviceData = "{\"temperature\" : 20.3 }";
IPayloadDeserializer deserializer = new JSONDeserializer();
InfomodelValue mappedOutput = mapper.mapSource(deserializer.deserialize(sampleDeviceData));
assertEquals(20.3, mappedOutput.get("outdoorTemperature").getStatusProperty("value").get().getValue());
assertEquals("Celcius", mappedOutput.get("outdoorTemperature").getStatusProperty("unit").get().getValue());
}
Aggregations