use of io.crnk.core.engine.internal.dispatcher.controller.ResourceGet 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.controller.ResourceGet 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.controller.ResourceGet 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