### Question:
BPMNPaletteDefinitionBuilder implements PaletteDefinitionBuilder<AbstractCanvasHandler, DefaultPaletteDefinition> { @Override public void build(final AbstractCanvasHandler canvasHandler, final Consumer<DefaultPaletteDefinition> paletteDefinitionConsumer) { paletteDefinitionBuilder .build(canvasHandler, paletteDefinition -> { paletteDefinition .getItems() .sort(Comparator.comparingInt(item -> getCategoryOrder(item.getId()))); createPaletteCustomTasksCategory(paletteDefinition, paletteDefinitionConsumer); }); } protected  BPMNPaletteDefinitionBuilder(); @Inject  BPMNPaletteDefinitionBuilder(final DefinitionManager definitionManager,
                                        final ExpandedPaletteDefinitionBuilder paletteDefinitionBuilder,
                                        final StunnerTranslationService translationService,
                                        final ManagedInstance<WorkItemDefinitionRegistry> workItemDefinitionRegistry,
                                        final DefinitionUtils definitionUtils,
                                        final BPMNCategoryDefinitionProvider categoryDefinitionProvider);   BPMNPaletteDefinitionBuilder(final DefinitionManager definitionManager,
                                 final ExpandedPaletteDefinitionBuilder paletteDefinitionBuilder,
                                 final StunnerTranslationService translationService,
                                 final Supplier<WorkItemDefinitionRegistry> workItemDefinitionRegistry,
                                 final Function<WorkItemDefinition, CustomTask> customTaskBuilder,
                                 final DefinitionUtils definitionUtils,
                                 final BPMNCategoryDefinitionProvider categoryDefinitionProvider); @PostConstruct void init(); @Override void build(final AbstractCanvasHandler canvasHandler,
                      final Consumer<DefaultPaletteDefinition> paletteDefinitionConsumer);  }### Answer:
@Test public void testBuild() { Consumer<DefaultPaletteDefinition> resultConsumer = mock(Consumer.class); tested.build(canvasHandler, resultConsumer); verify(resultConsumer, times(1)).accept(eq(PALETTE_DEFINITION)); assertTrue(PALETTE_DEFINITION.getItems().isEmpty()); }
@Test public void testBuildWithServiceTasks() { when(workItemDefinitionRegistry.items()).thenReturn(Collections.singletonList(WID)); when(workItemDefinitionRegistry.get(eq(WID_NAME))).thenReturn(WID); Consumer<DefaultPaletteDefinition> resultConsumer = mock(Consumer.class); tested.build(canvasHandler, resultConsumer); verify(resultConsumer, times(1)).accept(eq(PALETTE_DEFINITION)); assertFalse(PALETTE_DEFINITION.getItems().isEmpty()); }