DownloadMenuItemBuilder { public MenuItem build(final Supplier<Path> pathSupplier) { final String download = translationService.format(Constants.DownloadMenuItem_Download); return makeMenuItem(download, makeMenuItemCommand(pathSupplier)); } @Inject  DownloadMenuItemBuilder(final TranslationService translationService); MenuItem build(final Supplier<Path> pathSupplier);  }
@Test public void testBuild() { final String caption = "Download"; final Command menuItemCommand = () -> {}; when(translationService.format(Constants.DownloadMenuItem_Download)).thenReturn(caption); doReturn(menuItemCommand).when(downloadMenuItemBuilder).makeMenuItemCommand(pathSupplier); downloadMenuItemBuilder.build(pathSupplier); verify(downloadMenuItemBuilder).makeMenuItem(eq(caption), eq(menuItemCommand)); }