use of de.fraunhofer.iosb.ilt.faaast.service.model.api.StatusCode in project FAAAST-Service by FraunhoferIOSB.
the class HttpEndpointTest method testGetAllSubmodelElements_ValueOnly.
@Test
public void testGetAllSubmodelElements_ValueOnly() throws Exception {
List<SubmodelElement> submodelElements = List.of(new DefaultProperty.Builder().idShort("property1").value("hello world").valueType("string").build(), new DefaultRange.Builder().idShort("range1").min("1.1").max("2.0").valueType("double").build());
when(serviceContext.execute(any())).thenReturn(GetAllSubmodelElementsResponse.builder().statusCode(StatusCode.Success).payload(submodelElements).build());
ContentResponse response = execute(HttpMethod.GET, "/submodels/foo/submodel/submodel-elements", new OutputModifier.Builder().content(Content.Value).build());
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
List<ElementValue> actual = deserializer.readValueList(new String(response.getContent()), TypeExtractor.extractTypeInfo(submodelElements));
List<ElementValue> expected = submodelElements.stream().map(x -> (ElementValue) ElementValueMapper.toValue(x)).collect(Collectors.toList());
Assert.assertEquals(expected, actual);
}
Aggregations