### Question:
StaticListClassPropertyValuesProvider extends AbstractListClassPropertyValuesProvider<StaticListClass> { @Override protected PropertyValues getAllowedValues(StaticListClass propertyDefinition, int limit, String filter) throws Exception { final PropertyValues result = new PropertyValues(); List<String> allValues = StaticListClass.getListFromString(propertyDefinition.getValues()); allValues.stream().filter(s -> s.toLowerCase().contains(filter.toLowerCase())).limit(limit) .forEach(item -> result.withPropertyValues(new PropertyValue(item))); return result; }    }### Answer:
@Test public void getAllowedValues() throws Exception { StaticListClass staticListClass = new StaticListClass(); staticListClass.setValues("Foo|Bar|Toto|Tata|Foobar"); PropertyValues allowedValues = staticListClassPropertyValuesProvider.getAllowedValues(staticListClass, 1, "f"); assertEquals(Collections.singletonList(new PropertyValue("Foo")), allowedValues.getPropertyValues()); allowedValues = staticListClassPropertyValuesProvider.getAllowedValues(staticListClass, 2, "f"); assertEquals(Arrays.asList(new PropertyValue("Foo"), new PropertyValue("Foobar")), allowedValues.getPropertyValues()); allowedValues = staticListClassPropertyValuesProvider.getAllowedValues(staticListClass, 1, ""); assertEquals(Collections.singletonList(new PropertyValue("Foo")), allowedValues.getPropertyValues()); allowedValues = staticListClassPropertyValuesProvider.getAllowedValues(staticListClass, 5, ""); assertEquals(Arrays.asList(new PropertyValue("Foo"), new PropertyValue("Bar"), new PropertyValue("Toto"), new PropertyValue("Tata"), new PropertyValue("Foobar")), allowedValues.getPropertyValues()); allowedValues = staticListClassPropertyValuesProvider.getAllowedValues(staticListClass, 2, "foobar"); assertEquals(Collections.singletonList(new PropertyValue("Foobar")), allowedValues.getPropertyValues()); allowedValues = staticListClassPropertyValuesProvider.getAllowedValues(staticListClass, 1, "baz"); assertEquals(Collections.emptyList(), allowedValues.getPropertyValues()); allowedValues = staticListClassPropertyValuesProvider.getAllowedValues(staticListClass, 3, "o"); assertEquals(Arrays.asList(new PropertyValue("Foo"), new PropertyValue("Toto"), new PropertyValue("Foobar")), allowedValues.getPropertyValues()); }