ComponentRenderer extends Renderer<SOURCE> { public COMPONENT createComponent(SOURCE item) { if (componentFunction != null) { return componentFunction.apply(item); } COMPONENT component = componentSupplier.get(); if (itemConsumer != null) { itemConsumer.accept(component, item); } return component; } ComponentRenderer(SerializableSupplier<COMPONENT> componentSupplier,
            SerializableBiConsumer<COMPONENT, SOURCE> itemConsumer);  ComponentRenderer(
            SerializableSupplier<COMPONENT> componentSupplier);  ComponentRenderer(
            SerializableFunction<SOURCE, COMPONENT> componentFunction);  ComponentRenderer(
            SerializableFunction<SOURCE, COMPONENT> componentFunction,
            SerializableBiFunction<Component, SOURCE, Component> componentUpdateFunction); protected  ComponentRenderer(); @Override Rendering<SOURCE> render(Element container,
            DataKeyMapper<SOURCE> keyMapper, Element contentTemplate); void setComponentRendererTag(String componentRendererTag); COMPONENT createComponent(SOURCE item); Component updateComponent(Component currentComponent, SOURCE item);  }
@Test public void componentFunction_invokedOnCreate() { AtomicInteger createInvocations = new AtomicInteger(); ComponentRenderer<TestLabel, String> renderer = new ComponentRenderer<>( item -> { createInvocations.incrementAndGet(); Assert.assertEquals("New item", item); return new TestLabel(); }); renderer.createComponent("New item"); Assert.assertEquals( "The component creation function should have been invoked once", 1, createInvocations.get()); }