use of org.eclipse.vorto.service.mapping.spec.SpecWithConditionedRules in project vorto by eclipse.
the class JsonMappingTest method testMapSingleFunctionblockOfInfomodel2.
@Test
public void testMapSingleFunctionblockOfInfomodel2() {
IDataMapper<DittoData> mapper = IDataMapper.newBuilder().withSpecification(new SpecWithConditionedRules()).buildDittoMapper();
final String sampleHomeConnectRESTResponse = "{\"data\" : { \"key\" : \"DoorState\", \"value\" : \"Locked\"}}";
DittoData mappedDittoOutput = mapper.map(DataInput.newInstance().fromJson(sampleHomeConnectRESTResponse), MappingContext.empty());
System.out.println(mappedDittoOutput.toJson());
assertFalse(mappedDittoOutput.getFeatures().containsKey("operationState"));
Feature doorStateFeature = mappedDittoOutput.getFeatures().get("doorState");
assertEquals("Locked", (String) doorStateFeature.getStatusProperties().get("sensor_value"));
}
Aggregations