use of io.crnk.core.engine.internal.dispatcher.path.ResourcePath 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.ResourcePath in project crnk-framework by crnk-project.
the class RelationshipsResourceDeleteTest method onNonRelationRequestShouldDenyIt.
@Test
public void onNonRelationRequestShouldDenyIt() {
// GIVEN
JsonPath jsonPath = new ResourcePath("tasks");
ResourceRegistry resourceRegistry = mock(ResourceRegistry.class);
RelationshipsResourceDelete sut = new RelationshipsResourceDelete(resourceRegistry, typeParser, modificationFilters);
// WHEN
boolean result = sut.isAcceptable(jsonPath, REQUEST_TYPE);
// THEN
assertThat(result).isFalse();
}
use of io.crnk.core.engine.internal.dispatcher.path.ResourcePath in project crnk-framework by crnk-project.
the class ResourcePostTest method onNoBodyResourceShouldThrowException.
@Test
public void onNoBodyResourceShouldThrowException() throws Exception {
// GIVEN
ResourcePost sut = new ResourcePost(resourceRegistry, PROPERTIES_PROVIDER, typeParser, objectMapper, documentMapper, modificationFilters);
// THEN
expectedException.expect(RequestBodyNotFoundException.class);
// WHEN
sut.handle(new ResourcePath("tasks"), emptyTaskQuery, null, null);
}
use of io.crnk.core.engine.internal.dispatcher.path.ResourcePath in project crnk-framework by crnk-project.
the class ResourcePostTest method onUnknownResourceTypeShouldThrowException.
@Test
public void onUnknownResourceTypeShouldThrowException() throws Exception {
// GIVEN
ResourcePost sut = new ResourcePost(resourceRegistry, PROPERTIES_PROVIDER, typeParser, objectMapper, documentMapper, modificationFilters);
// THEN
expectedException.expect(RepositoryNotFoundException.class);
// WHEN
sut.handle(new ResourcePath("fridges"), emptyTaskQuery, null, null);
}
use of io.crnk.core.engine.internal.dispatcher.path.ResourcePath in project crnk-framework by crnk-project.
the class ControllerRegistryBuilderTest method onBuildShouldAddAllControllers.
@Test
public void onBuildShouldAddAllControllers() throws Exception {
// GIVEN
PropertiesProvider propertiesProvider = Mockito.mock(PropertiesProvider.class);
ResourceFilterDirectory resourceFilterDirectory = Mockito.mock(ResourceFilterDirectory.class);
ControllerRegistryBuilder sut = new ControllerRegistryBuilder(null, null, null, propertiesProvider, resourceFilterDirectory, (List) Collections.emptyList());
// WHEN
ControllerRegistry result = sut.build();
// THEN
result.getController(new ResourcePath("path"), "GET");
}
Aggregations