### Question:
DMNEditorMenuSessionItems extends AbstractDiagramEditorMenuSessionItems<DMNEditorMenuItemsBuilder> { MenuItem newPerformAutomaticLayout() { final Button button = GWT.create(Button.class); button.setSize(ButtonSize.SMALL); button.setTitle(getTranslationService().getValue(CoreTranslationMessages.PERFORM_AUTOMATIC_LAYOUT)); button.setIcon(IconType.SITEMAP); button.addClickHandler(clickEvent -> ((DMNEditorSessionCommands) getCommands()).getPerformAutomaticLayoutCommand().execute()); final MenuUtils.HasEnabledIsWidget buttonWrapper = MenuUtils.buildHasEnabledWidget(button); return MenuUtils.buildItem(buttonWrapper); } @Inject  DMNEditorMenuSessionItems(final DMNEditorMenuItemsBuilder itemsBuilder,
                                     final @DMNEditor DMNEditorSessionCommands sessionCommands); @Override void populateMenu(final FileMenuBuilder menu); @Override void setEnabled(final boolean enabled);  }### Answer:
@Test @SuppressWarnings("unchecked") public void testPerformAutomaticLayoutMenuItem() { final PerformAutomaticLayoutCommand command = mock(PerformAutomaticLayoutCommand.class); final ArgumentCaptor<ClickHandler> clickHandlerArgumentCaptor = ArgumentCaptor.forClass(ClickHandler.class); when(sessionCommands.getPerformAutomaticLayoutCommand()).thenReturn(command); sessionItems.newPerformAutomaticLayout(); verify(button).setSize(ButtonSize.SMALL); verify(button).setTitle(CoreTranslationMessages.PERFORM_AUTOMATIC_LAYOUT); verify(button).setIcon(IconType.SITEMAP); verify(button).addClickHandler(clickHandlerArgumentCaptor.capture()); final ClickHandler clickHandler = clickHandlerArgumentCaptor.getValue(); clickHandler.onClick(mock(ClickEvent.class)); verify(command).execute(); }