ComponentPropertyGenerator extends PropertyValueGenerator<Component> { @Override public SortOrder[] getSortProperties(SortOrder order) { if (hidesBeanField(order)) { return new SortOrder[]{order}; } else { return new SortOrder[0]; } } ComponentPropertyGenerator(Class<T> typeOfRows, ComponentGenerator<T> generator); @Override Component getValue(Item item, Object itemId, Object propertyId); @Override SortOrder[] getSortProperties(SortOrder order); @Override Class<Component> getType();  }
@Test public void testGetSortProperties() { SortOrder sortOrder = new SortOrder("caption", SortDirection.ASCENDING); SortOrder[] sortOrderArray = generator.getSortProperties(sortOrder); assertThat(sortOrderArray, is(arrayWithSize(1))); assertThat(sortOrder, is(sameInstance(sortOrderArray[0]))); }
@Test public void testGetSortPropertiesWithPrefix() { SortOrder sortOrder = new SortOrder("something", SortDirection.ASCENDING); SortOrder[] sortOrderArray = generator.getSortProperties(sortOrder); assertThat(sortOrderArray, is(arrayWithSize(1))); assertThat(sortOrder, is(sameInstance(sortOrderArray[0]))); }
@Test public void testGetSortPropertiesWithPropertyNotInBean() { SortOrder sortOrder = new SortOrder("notinbean", SortDirection.ASCENDING); SortOrder[] sortOrderArray = generator.getSortProperties(sortOrder); assertThat(sortOrderArray, is(arrayWithSize(0))); }