GraphConfigurationServiceV2 implements IGraphConfigurationServiceV2 { @Override public Response getFilterFunction() { return Response.ok(ReflectionUtil.getSubTypes(Predicate.class)) .header(GAFFER_MEDIA_TYPE_HEADER, GAFFER_MEDIA_TYPE) .build(); } GraphConfigurationServiceV2(); static void initialise(); @Override Response getSchema(); @Override Response getFilterFunction(); @SuppressFBWarnings(value = "REC_CATCH_EXCEPTION", justification = "Need to wrap all runtime exceptions before they are given to the user") @Override Response getFilterFunction(final String inputClass); @SuppressFBWarnings(value = "REC_CATCH_EXCEPTION", justification = "Need to wrap all runtime exceptions before they are given to the user") @Override Response getSerialisedFields(final String className); @SuppressFBWarnings(value = "REC_CATCH_EXCEPTION", justification = "Need to wrap all runtime exceptions before they are given to the user") @Override Response getSerialisedFieldClasses(final String className); @Override Response getDescription(); @Override Response getTransformFunctions(); @Override Response getStoreTraits(); @Override Response getElementGenerators(); @Override Response getObjectGenerators();  }
@Test public void shouldGetFilterFunctions() { final Set<Class> classes = (Set<Class>) service.getFilterFunction(null).getEntity(); assertThat(classes, IsCollectionContaining.hasItem(IsA.class)); }
@Test public void shouldGetFilterFunctionsWithInputClass() { final Set<Class> classes = (Set<Class>) service.getFilterFunction(Long.class.getName()).getEntity(); assertThat(classes, IsCollectionContaining.hasItem(IsLessThan.class)); assertThat(classes, IsCollectionContaining.hasItem(IsMoreThan.class)); assertThat(classes, IsCollectionContaining.hasItem(Not.class)); }
@Test public void shouldThrowExceptionWhenGetFilterFunctionsWithUnknownClassName() { try { service.getFilterFunction("unknown className"); fail("Exception expected"); } catch (final IllegalArgumentException e) { assertTrue(e.getMessage().contains("Input class was not recognised:")); } }