use of de.fraunhofer.iosb.ilt.faaast.service.model.request.PostSubmodelElementRequest in project FAAAST-Service by FraunhoferIOSB.
the class RequestHandlerManagerTest method testPostSubmodelElementRequest.
@Test
public void testPostSubmodelElementRequest() throws ResourceNotFoundException {
Reference reference = ReferenceHelper.toReference(environment.getSubmodels().get(0).getIdentification(), Submodel.class);
when(persistence.put(reference, (Reference) null, environment.getSubmodels().get(0).getSubmodelElements().get(0))).thenReturn(environment.getSubmodels().get(0).getSubmodelElements().get(0));
PostSubmodelElementRequest request = new PostSubmodelElementRequest.Builder().id(environment.getSubmodels().get(0).getIdentification()).submodelElement(environment.getSubmodels().get(0).getSubmodelElements().get(0)).build();
PostSubmodelElementResponse response = manager.execute(request);
PostSubmodelElementResponse expected = new PostSubmodelElementResponse.Builder().statusCode(StatusCode.SuccessCreated).payload(environment.getSubmodels().get(0).getSubmodelElements().get(0)).build();
Assert.assertEquals(expected, response);
}
Aggregations