use of de.fraunhofer.iosb.ilt.faaast.service.model.request.DeleteSubmodelElementByPathRequest in project FAAAST-Service by FraunhoferIOSB.
the class RequestHandlerManagerTest method testDeleteSubmodelElementByPathRequest.
@Test
public void testDeleteSubmodelElementByPathRequest() throws ResourceNotFoundException {
Submodel submodel = environment.getSubmodels().get(0);
Reference reference = ReferenceHelper.toReference(ReferenceHelper.toKeys(SUBMODEL_ELEMENT_REF), submodel.getIdentification(), Submodel.class);
when(persistence.get(reference, new QueryModifier())).thenReturn(environment.getSubmodels().get(0).getSubmodelElements().get(0));
DeleteSubmodelElementByPathRequest request = new DeleteSubmodelElementByPathRequest.Builder().id(submodel.getIdentification()).path(ReferenceHelper.toKeys(SUBMODEL_ELEMENT_REF)).build();
DeleteSubmodelElementByPathResponse response = manager.execute(request);
DeleteSubmodelElementByPathResponse expected = new DeleteSubmodelElementByPathResponse.Builder().statusCode(StatusCode.Success).build();
Assert.assertEquals(expected, response);
verify(persistence).remove(reference);
}
Aggregations