use of io.crnk.core.engine.internal.dispatcher.path.JsonPath in project crnk-framework by crnk-project.
the class RelationshipsResourcePostTest method onValidRequestShouldAcceptIt.
@Test
public void onValidRequestShouldAcceptIt() {
// GIVEN
JsonPath jsonPath = pathBuilder.build("tasks/1/relationships/project");
ResourceRegistry resourceRegistry = mock(ResourceRegistry.class);
RelationshipsResourcePost sut = new RelationshipsResourcePost(resourceRegistry, typeParser, modificationFilters);
// WHEN
boolean result = sut.isAcceptable(jsonPath, REQUEST_TYPE);
// THEN
assertThat(result).isTrue();
}
use of io.crnk.core.engine.internal.dispatcher.path.JsonPath in project crnk-framework by crnk-project.
the class RelationshipsResourcePostTest method onNonRelationRequestShouldDenyIt.
@Test
public void onNonRelationRequestShouldDenyIt() {
// GIVEN
JsonPath jsonPath = new ResourcePath("tasks");
ResourceRegistry resourceRegistry = mock(ResourceRegistry.class);
RelationshipsResourcePost sut = new RelationshipsResourcePost(resourceRegistry, typeParser, modificationFilters);
// WHEN
boolean result = sut.isAcceptable(jsonPath, REQUEST_TYPE);
// THEN
assertThat(result).isFalse();
}
use of io.crnk.core.engine.internal.dispatcher.path.JsonPath in project crnk-framework by crnk-project.
the class ResourceGetTest method onGivenRequestResourceGetShouldAcceptIt.
@Test
public void onGivenRequestResourceGetShouldAcceptIt() {
// GIVEN
JsonPath jsonPath = pathBuilder.build("/tasks/2");
ResourceGet sut = new ResourceGet(resourceRegistry, typeParser, documentMapper);
// WHEN
boolean result = sut.isAcceptable(jsonPath, REQUEST_TYPE);
// THEN
Assert.assertEquals(result, true);
}
use of io.crnk.core.engine.internal.dispatcher.path.JsonPath in project crnk-framework by crnk-project.
the class ResourceGetTest method onMethodMismatchShouldDenyIt.
@Test
public void onMethodMismatchShouldDenyIt() {
// GIVEN
JsonPath jsonPath = pathBuilder.build("/tasks/2");
ResourceGet sut = new ResourceGet(resourceRegistry, typeParser, documentMapper);
// WHEN
boolean result = sut.isAcceptable(jsonPath, "POST");
// THEN
Assert.assertEquals(result, false);
}
use of io.crnk.core.engine.internal.dispatcher.path.JsonPath in project crnk-framework by crnk-project.
the class ResourceGetTest method onGivenRequestResourceGetShouldThrowError.
@Test(expected = ResourceNotFoundException.class)
public void onGivenRequestResourceGetShouldThrowError() throws Exception {
// GIVEN
JsonPath jsonPath = pathBuilder.build("/tasks/" + -1);
ResourceGet sut = new ResourceGet(resourceRegistry, typeParser, documentMapper);
// WHEN
Response response = sut.handle(jsonPath, emptyTaskQuery, null, null);
// THEN
Assert.assertNull(response);
}
Aggregations