ServiceBasedDetailsEditGrid extends BaseDetailsEditGrid<U, ID, T> implements CanAssignEntity<ID2, U> { @Override protected DataProvider<T, SerializablePredicate<T>> getDataProvider() { return provider; } ServiceBasedDetailsEditGrid(BaseService<ID, T> service, EntityModel<T> entityModel, AttributeModel attributeModel,
            boolean viewMode, FormOptions formOptions, FetchJoinInformation... joins); @Override void assignEntity(U u); Function<U, SerializablePredicate<T>> getFilterSupplier(); int getItemCount(); @Override U getValue(); void setFilterSupplier(Function<U, SerializablePredicate<T>> filterSupplier);  }
@Test @SuppressWarnings({ "unchecked" }) public void testReadOnlyWithSearch() { EntityModel<TestEntity> em = factory.getModel(TestEntity.class); ServiceBasedDetailsEditGrid<Integer, TestEntity, Integer, TestEntity2> grid = createGrid(em, null, false, true, new FormOptions().setDetailsGridSearchMode(true)); grid.setService(service); IdBasedDataProvider<Integer, TestEntity> provider = (IdBasedDataProvider<Integer, TestEntity>) grid.getGrid().getDataProvider(); assertEquals(0, provider.getSize()); assertFalse(grid.getAddButton().isVisible()); assertTrue(grid.getSearchDialogButton().isVisible()); }