To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.
Trigger MenuBar.MenuItem's command for unit testing.
7 years ago Oct 22, 2015 9:56pm
I have a builder that creates a MenuBar Component. I am now trying to create the unit tests for that Builder class. I would like to be able to simulate a user clicking on one of the Menu Items, like i can for a button with Button.click(), but there doesnt seem to be a click or comparable method on the MenuItem class.
Is there some other way of triggering the command associated with the MenuItem, so that i can test that my Builder class has actually constructed the Menu Correctly?
Note: I do not wish to test the actual command here, just that the correct command is triggered when the appropriate MenuItem is selected.
(I have found teh following https://vaadin.com/forum/#!/thread/289580/289579 which indicates that 5 years ago this functionality wasnt available... im hopeing things have moved on since then)