use of io.crnk.core.engine.internal.dispatcher.controller.ResourceDelete in project crnk-framework by crnk-project.
the class ResourceDeleteTest method onGivenRequestResourceGetShouldHandleIt.
@Test
public void onGivenRequestResourceGetShouldHandleIt() throws Exception {
// GIVEN
JsonPath jsonPath = pathBuilder.build("/tasks/1");
ResourceDelete sut = new ResourceDelete(resourceRegistry, new ArrayList<ResourceModificationFilter>());
// WHEN
Response response = sut.handle(jsonPath, emptyTaskQuery, null, null);
// THEN
assertThat(response.getDocument()).isNull();
}
use of io.crnk.core.engine.internal.dispatcher.controller.ResourceDelete in project crnk-framework by crnk-project.
the class ResourceDeleteTest method onValidRequestShouldAcceptIt.
@Test
public void onValidRequestShouldAcceptIt() {
// GIVEN
JsonPath jsonPath = pathBuilder.build("tasks/1");
ResourceRegistry resourceRegistry = mock(ResourceRegistry.class);
ResourceDelete sut = new ResourceDelete(resourceRegistry, new ArrayList<ResourceModificationFilter>());
// WHEN
boolean result = sut.isAcceptable(jsonPath, REQUEST_TYPE);
// THEN
assertThat(result).isTrue();
}
use of io.crnk.core.engine.internal.dispatcher.controller.ResourceDelete in project crnk-framework by crnk-project.
the class ResourceDeleteTest method onNonRelationRequestShouldDenyIt.
@Test
public void onNonRelationRequestShouldDenyIt() {
// GIVEN
JsonPath jsonPath = new ResourcePath("tasks/1/relationships/project");
ResourceRegistry resourceRegistry = mock(ResourceRegistry.class);
ResourceDelete sut = new ResourceDelete(resourceRegistry, new ArrayList<ResourceModificationFilter>());
// WHEN
boolean result = sut.isAcceptable(jsonPath, REQUEST_TYPE);
// THEN
assertThat(result).isFalse();
}
Aggregations