@Test public void onGivenRequestFieldResourceGetShouldHandleIt() throws Exception { // GIVEN Request request = new Request( parsePathFromStringUrl("http://domain.local/tasks/1/project"), REQUEST_TYPE, null, parameterProvider); FieldResourceGet sut = new FieldResourceGet( resourceRegistry, typeParser, includeFieldSetter, queryParamsBuilder, objectMapper); // WHEN BaseResponseContext response = sut.handle(request); // THEN Assert.assertNotNull(response); }
@Test public void onNonRelationRequestShouldDenyIt() { // GIVEN Request request = new Request( parsePathFromStringUrl("http://domain.local/tasks"), REQUEST_TYPE, null, parameterProvider); ResourceRegistry resourceRegistry = mock(ResourceRegistry.class); IncludeLookupSetter includeFieldSetter = mock(IncludeLookupSetter.class); FieldResourceGet sut = new FieldResourceGet( resourceRegistry, typeParser, includeFieldSetter, queryParamsBuilder, objectMapper); // WHEN boolean result = sut.isAcceptable(request); // THEN assertThat(result).isFalse(); }